Apache::Imager::Resize is a simple fixup class that only does one job: it resizes images before they're delivered. All you have to do is append either a width and/or a height parameter to any image file address, and AIR will make sure that an appropriately shrunken image file is returned. It caches the results of each operation, so the first request might take a little while but subsequent similar requests should be very quick.
There are other modules that you could do this with: see the links at the bottom of this pod. If your requirements might include more complicated transformations, or you're running mod_perl behind a thin proxy, you're probably better off with Apache::ImageMagick. There are also several solutions for thumbnailing, but if your only requirement is to be able to show images at an arbitrary size in a simple, clean way, this module might be for you.
The handler uses Imager to do the work. I intend to produce a proper general-purpose Apache::Imager package, if nobody else does, so this will end up being a special case with a simplified interface, and will probably live alongside an Apache::Imager::Translate and other useful shortcut modules.
SYNOPSIS
< Files "*.jpg" >
PerlFixupHandler Apache::Imager::Resize
ImgResizeCacheDir '/imgcache'
< /Files >
# or
< Location "/liveimages" >
PerlHandler Apache::Imager::Resize
ImgResizeNoCache on
ImgResizeWidthParam 'w'
ImgResizeHeightParam 'h'
< /Location >
# and on a web page somewhere:
< img src="image.jpg?w=300&h=200" width="300" height="200" >
Product's homepage
Requirements:
· Perl