REST-api
POST http://resizor.com/assets.(json|xml)
Parameters
api_key: Your API-key
file: the file that is being uploaded
Example response
{"asset": { "id":13, "name":"img_1531_7842a496a5f58488", "extension":"jpg", "mime_type":"image/jpeg", "height":693, "width":520, "file_size":102059, "created_at":"2010-10-23T13:07:25Z" } }
Example request
curl -v --form file=@my_image.jpg --form api_key=aaaabbbbccccddddeeee http://resizor.com/assets.json
GET http://resizor.com/assets/id.format
Parameters
id: The id or name of an uploaded asset
format: format of returned image (jpg, png, gif)
size: description of size/cropping settings for returned image More about this
token: SHA1 digest in hexadecimal form of string "API_KEY-ASSET_ID-SIZE_DESCRIPTION-FORMAT"
Example responses
Status: 301 (redirect to S3)
Status: 200 (raw image data)
Example request
curl http://resizor.com/assets/1.jpg?size=c100x100&token=1af23rde0123456cccc78910e02abcd401234567
CDN compatible usage
When using Resizor with CloudFront these requests needs to be reformated as CloudFront doesn't handle query string params. This is what Resizor's ”CDN origin host” is for, only your assets is allowed to be accessed through your CDN origin host, this makes it safe to use that host as a custom origin for a CloudFront distribution.
The following request:
http://resizor.com/assets/1.jpg?size=c100x100&token=1af23rde0123456cccc78910e02abcd401234567
would need to be transformed into:
http://[your-cdn-origin-host].resizor.com/assets/c100x100/1af23rde0123456cccc78910e02abcd401234567/1.jpg
Your CDN origin host is available on the account screen when logged in.
GET http://resizor.com/assets.(json|xml)
Parameters
api_key: Your API-key
Example response
[{"asset": { "name": "img_1531_a64b5ba684ce4c64", "created_at":"2010-10-17T11:39:53Z", "extension":"jpg", ... } }, {"asset": { "name": "img_2121_a64b5ba684ce4c64", "created_at":"2010-10-16T11:39:53Z", "extension":"jpg", ... } }]
Example request
curl -v http://resizor.com/assets.json?api_key=aaaabbbbccccddddeeee
DELETE http://resizor.com/assets/id.(json|xml)
Parameters
id: The id or name of an uploaded asset
api_key: Your API-key
Example response
Status: 200
Example request
curl -X DELETE http://resizor.com/assets/1.json?api_key=aaaabbbbccccddddeeee
SSL
All API-calls are available through HTTPS. HTTPS is encouraged to use for all calls that uses the ”api_key” parameter.
curl -v --form file=@my_image.jpg --form api_key=aaaabbbbccccddddeeee https://resizor.com/assets.json
Resizing and cropping
Use the follwing syntax to specify size of a returned image.
685
Renders the image within a 685px square. If the image is in landscape format it will be 685px wide. An image in portrait format will be 685px high.685x500
Renders the image within a rectangle with a width of 685px and a height of 500px.w685
Renders the image with a width of 685px.h685
Renders the image with a height of 685px.c200x250
Renders the image cropped to 200px width and 250px height.original
This will return the original images.
Example
http://resizor.com/assets/1.jpg?size=300x200&token=1af23rde0123456cccc78910e02abcd401234567