vigour-io / shutter

Makes a sprite out of an array of urls
ISC License
1 stars 0 forks source link

vigour-shutter

Online image manipulation service

Usage

See the vigour-config docs for information on how to configure and launch the shutter and where to get more info for all the configuration options.

As a minimum, you will to provide the following configuration options:

Dependencies

API

In all cases, you can use any of the following query string parameters to modifying the behavior:

Notes

Fallback images

If you ask the shutter for an image it can not find, it will try responding with a fallback image of the same dimensions following this procedure:

  1. If you have included &fallback=<URL> in your query string, the image found at that URL will be downloaded, resized, transformed according to the specified effect (if any) and sent as a fallback image, along with the following extra header: X-Fallback-Type: 'provided'
  2. If not, Shutter will look at the domain of the requested image and try to match it with one of the domains provided to shutter on startup (see below). If the domain is found, the fallback associated to that domain will be downloaded, resized, transformed according to the specified effect (if any) and sent as a fallback image, along with the following extra header: X-Fallback-Type: 'domain'
  3. If the domain doesn't match any of the domains provided to Shutter on startup, Shutter will download, resize, transform according to the specified effect (if any) and send the default fallback image provided to Shutter on startup (see below), along with the following extra header: X-Fallback-Type: 'default'

Examples

One-time fallback image
GET /image?url=http://uhohIdontexist.com/returns404.png&width=900&height=600&fallback=http://thankgodIexist.com/img.png
Configuring fallback images:

fallbackConfig.json

{
  "fallbacks": {
    "val": "<DEFAULT_FALLBACK_URL>",
    "somedomain.com": "<FALLBACK_URL_FOR_somedomain.com>",
    "anotherdomain.com": "<FALLBACK_URL_FOR_anotherdomain.com>"
  }
}

Don't forget to merge the config when starting the shutter (see usage)

shutter --mergeFiles '["./fallbackConfig.json"]'

Effects

See test/node/post.js and test/node/get.js