mod_image

Note, as of April 2002, I no longer host my own web site on my own machine (I now use Speedhost), so that means that I can no longer use mod_image. As a bonus, I have bundled with mod_image the source code to the program that I used to transform the web site from one that uses mod_image to a static site. Maybe someone out there can build on this too?


mod_image is my attempt at an Apache module to perform automatic JPEG-scaling in the server. Scaled JPEGs are then cached on the server in a temporary directory so that any subsequent accesses use the cached version. This eliminates the need to generate and maintain thumbnails and the like.

Scaling information is simply placed on the query string. mod_image will only activate when a .jpg file is being accessed with a scale factor on the query string. The standard libjpeg that everyone uses does the dirty work. Below is a demonstration:

<IMG SRC="asia2000/100211.jpg?.002">
<IMG SRC="asia2000/100211.jpg?.2">

Back when I hosted my own site, I said "If you don't believe me, look at the page source :-)". Can't say that anymore :-(

Okay whats the catch...

I've tested and deployed this on Apache 1.3.20 on Win2000 (I'm one of the few that use Apache on Win32). With help from David Nicklay, I merged in changes that allowed it to compile on UNIX. Additionally, there is no cache management - a malicious user could fill up your temp volume with a short amount of work, so I do not recommend putting this on a production machine. I'm releasing this with the vague belief that someone out there might find it useful. The license is the GNU LPGL.

If you get this to compile, you simply have to add this line to your httpd.conf

LoadModule image_module <path to mod_image>

Interesting ideas that I probably don't have time for

If you have questions, you can contact me here


Back to my home page