Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm investigating what products are out there that will allow you to request images through a HTTP API in arbitrary image sizes. The server would behind a CDN but would still need to be able to handle a fair bit of traffic and be possibly load-balanced.

I've been tasked with writing such a service, but I wanted to do some due diligence to see what commercial or open source solutions are out there. Google has not been particularly helpful. It may be because I have been searching for the wrong term.

Third-party sites and services are out of the question because of corporate policies.

share|improve this question
add comment

3 Answers

By sizes do you mean file sizes or image height/width?

They may not necessarily allow "arbitrary" sizes but bandwidth-reducing proxies (aka "accelerators") recompress image files to shrink them, among other bandwidth-saving tricks. Wikipedia has a page about them with a list of options.

If mean to rescale images on the fly, that's basically what a thumbnail script does. A lot of them are run in advance, but there are others that are "on the fly". For instance CPAN's Imager module has an example CGI script that scales an uploaded image to 200x200.

share|improve this answer
add comment

You can use ImageMagick with php/perl/python. It will allow you to resize the image. The only catch here is that you want to cache the image, Ideally.

For making the image cache friendly you would have to redirect to a unique URL and will have to keep the state of the for every call for redirection.

example.

http://example.com/resize/image.php?image=example.jpg&width=640&height=320 which does resizing of example.jpg. For this to be cache able image.php sould return a url redirection. http://example.com/resize/static/example640x320.jpg

For the second URL ensure that you have the correct expiration headers set so that the CDN can cache it. But you also have to maintain the mapping of
http://example.com/resize/image.php?image=example.jpg&width=640&height=320 to http://example.com/resize/static/example640x320.jpg
because with every request for that image, the image.php script will be called.
For data synchronization in a load balanced scenario you have a nfs share or use rsync if a delay of few seconds is acceptable or use file upload via API (of course secure it) to synchronize data between the backend servers.

share|improve this answer
add comment
up vote 0 down vote accepted

I've found an open-source Apache module called mod_dims. It fits most of my requirements and it is quite speedy.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.