/upload

upload a file to the API from a web form.

example: curl -i -F file=@photo.jpg http://img.tinyfactory.io/upload

You will receive a JSON response that looks like this:

{
    "success":true,
    "data":{
        "hash":"671e3346e405b99441bf4f0de7abc4dd",
        "url":"http://img.tinyfactory.io/img/671e3346e405b99441bf4f0de7abc4dd"
    }
}

the url param will be used for image rendering requests

/img/:hash

the /img/ endpoint handles rendering previously uploaded files using varous GET params. For example:

http://img.tinyfactory.io/img/671e3346e405b99441bf4f0de7abc4dd?action=thumbnail&w=500&h=500

actions

actions direct the API to modify a previously uploaded image.

crop

crop an image. currently only crops from the center

request params
param description
w width in pixels
h height in pixels

example:
http://img.tinyfactory.io/img/671e3346e405b99441bf4f0de7abc4dd?action=crop&w=500&=500

resize-clip

resize an image to a smaller size while maintaining aspect ratio, and then clipping off excess space around the edge based on supplied params.

request params
param description
w width in pixels
h height in pixels
algo resize algo to apply. supported algos:
  • nearestNeighbor (default)
  • bilinear
  • mitchellNetravali
  • lanczos2
  • lanczos3

example:
http://img.tinyfactory.io/img/671e3346e405b99441bf4f0de7abc4dd?action=resize-clip&w=500&=500

resize-preserve

resize an image to a smaller size while maintaining aspect ratio. if the dimensions provided are larger than the original image, the original image is served.

request params
param description
w width in pixels
h height in pixels
algo resize algo to apply. supported algos:
  • nearestNeighbor (default)
  • bilinear
  • mitchellNetravali
  • lanczos2
  • lanczos3

example:
http://img.tinyfactory.io/img/671e3346e405b99441bf4f0de7abc4dd?action=resize-preserve&w=500&=500