Post Requests

Generally, Imagizer works as a layer between users and image storage. A GET request will inform Imagizer to fetch an image from image storage and then perform image processing on that fetched image. An alternative is to POST an image file directly to Imagizer, along with some parameters, and have Imagizer return the processed image.

Multipart POST requests are supported.

TIP

Post requests on port 80 are disabled by default. See the Config Reference for details on enabling POST requests.

WARNING

Not currently supported on cloud.imagizer.com.

Example: POST an image file, scale the image to 400px width, set the quality to 65, then return the processed image.

POST / HTTP/1.1
Content-Type: multipart/form-data;

file=@in-image.jpg
width=400
quality=65
curl -F file=@in-image.jpg -F width=400 -F {host}

Example: POST an image file, detect faces, and return JSON meta data.

POST / HTTP/1.1
Content-Type: multipart/form-data;

file=@in-image.jpg
meta=true
face=true
curl -F file=@in-image.jpg -F meta=true -F face=true http://{host}/ -o out-meta.json

Write to Cache

It may be desirable to write images into Imagizer's local cache. This allows for a pre-warming of the cache, preventing Imagizer from fetching an origin image later and speeding up any subsequent requests. Write to cache is available through port 17007.

WARNING

Take care to only open the port on your firewall to trusted IP Addresses.

WARNING

Write to Cache is not currently supported on Cluster configuration.

Perform a multipart/form-data file upload to the intended URL of the image.

Example: POST an image file, cache the original image, scale the image to 400px width, and then cache the processed image.
The original image will be cached at /image.jpg and the process image cached at /image.jpg?width=400.

POST / HTTP/1.1
Content-Type: multipart/form-data;

file=@in-image.jpg
width=400
curl -F file=@in-image.jpg "http://{host}/image.jpg?width=400"

Preprocessing

Using the cache_processed parameter will inform imagizer to preprocess the image before caching, allowing the cached origin image to be modified. All subsequent requests will use the preprocessed image.

Example: POST an image file, scale the image to 400px width, and then cache the processed image.
The preprocessed image will be cached at /image.jpg.

POST /image.jpg HTTP/1.1
Content-Type: multipart/form-data;

file=@in-image.jpg
cache_processed=true
width=400
curl -F file=@in-image.jpg "http://{host}/image.jpg"