One of my latest projects requires an image server which had to fulfill these two API requirements:
- Storing: Accept a URL as an image source then provide a token to address the cached/stored image.
- Reading: Accept a token to provide an image in a specified resolution and/or format.
- The read API should provide a method to crop and resize images.
- For the purposes of my project, I require the machine to...
- accept JPEG, GIF, PNG, and SVG
- only serve JPG's
Download
The code is on GitHub. Download and modify as you please.
Basic API format
- Storing:
/store/secret-key/base64_encoded_URL
- Reading:
/key/token/size
Storing an Image
Calling the API with parameters something like this:

Should result in JSON looking something like this:
Reading an Image
Calling the API with parameters something like this (using the token from above):


Demo Settings File
My Experience on a Hosted Solution
I use the GridService product offered by MediaTemple for my hosting. I followed this article to get the ImageMagick PECL working. But ended up discovering that the extension was quite limited compared to the native console convert. So I fell back to using PHP's exec.
1 comment:
As a programmer, there is a tool, I would like to suggest, that tool is
url-decode.com/tool/base64-encode
That link also contains the tool, related to encode and decode (URL, base64), converter, developer tools, IP related tools, and many more. You must check it out.
Post a Comment