Uploads

Authorization

Imagizer Cloud

You must first request an Auth token from https://cloud.imagizer.com/tokensopen in new window. Then you may add the token to the Authorization header on the upload request.

Authorization: Bearer {auth_token}

Stand-alone Imagizer

Stand-alone Imagizer does not currently provide an authorization method. Uploads are disabled by default and when enabled can be limited to port 17007.

WARNING

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

Upload to a S3 Backend

Upload support allows for image files to be written through Imagizer into an S3 bucket. Imagizer can optionally preprocess images before storing them on S3. Images are accessible for use immediately after uploading.

Configuration

Imagizer Cloud

See the Imagizer Cloud Basic Configuration section for information on enabling uploads.

Stand-alone Imagizer

See the Uploads configuration section for information on enabling uploads.

Upload

Upon upload, images are written into Imagizer's local cache, preventing Imagizer from fetching origin images later and speeding up any subsequent requests. The image will then be uploaded into the configured S3 bucket.

Perform a multipart/form-data file upload to the intended URL of the image. The image path will be used as the S3 object key.

Example: Upload an image through Imagizer and into an S3 backend.

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

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

Delete

Imagizer does not currently support deleting images. You must delete files directly from your S3 Bucket.

Preprocessing

Using the cache_processed parameter will inform imagizer to preprocess the image before caching and uploading, 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"

Upload to Imagizer Storage

Imagizer offers built-in image storage free of charge. Imagizer storage is backed by Amazon S3 which guarantees high reliability and protects against data loss. You may upload images directly to Imagizer. Images are accessible for use immediately after uploading.

TIP

Available only on Imagizer Cloudopen in new window.

Configuration

See the Imagizer Cloud Basic Configuration section for information on enabling Imagizer Storage.

Upload

Example: upload an image to Imagizer Storage

POST /api/v1/images HTTP/1.1
Authorization: Bearer {auth_token}
Content-Type: multipart/form-data;

file=@in-image.jpg
curl -X POST \
    -H "Authorization: Bearer {auth_token}" \
    -F file=@in-image.jpg \
    https://{source}.cloud.imagizer.com/api/v1/images"

Example: response

{
   "url":"http:\/\/{source}.cloud.imagizer.com\/{filename}",
   "width":{width},
   "height":{height}
}

Delete

Example: delete an image from Imagizer Storage

DELETE {image_url} HTTP/1.1
Authorization: Bearer {auth_token}
curl -X DELETE \
    -H "Authorization: Bearer {auth_token}" \
    {image_url}
Last Updated:
Contributors: Nicholas Pettas, mikhail