GithubHelp home page GithubHelp logo

imclab / node-connect-image-proxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mysociety/node-connect-image-proxy

0.0 1.0 0.0 217 KB

A Node.js Connect middleware for proxing (and manipulating) images.

License: Other

node-connect-image-proxy's Introduction

Middleware for proxying and manipulating images

This module allows you to manipulate and convert images on the fly.

It provides:

  • Resizing of images
  • Conversion of images to grayscale
  • Conversion of images into different formats
  • Only proxies images from the same domain that the proxy is running on - not an open proxy (this could be easily changed in future)

Installation

npm install connect-image-proxy

and then in your code (eg an Express app):

var image_proxy = require('connect-image-proxy');

app.configure(function(){
  ....

  // mount the proxy at '/proxy'
  app.use( '/proxy', image_proxy() );
  ....
});

Usage

  • Resize: hostname/route/?url=[url]&resize=1&height=[height]&width=[width]
  • Grayscale: hostname/route/?url=[url]&grayscale=1
  • Conversion [JPG, PNG, GIF]: hostname/route/?url=[url]&format=[format]
  • Conversion + Grayscale + Resize: hostname/route/?url=[url]&format=png&grayscale=1&resize=1&height=[height]&width=[width]

Example app

There is an example app in the examples folder that demonstrates the basic features.

TODO

  • Allow user to specify a list of hostnames to proxy for, not just the same host as the proxy is running on.
  • Add proper caching headers, or at least repeat the cache headers of the original image.

node-connect-image-proxy's People

Contributors

chetan1 avatar evdb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.