Conrad Parker

FastPhoto

[ Introduction | Usage | Download | Development | License | Contact ]

Latest version: 0.9.0

Introduction

FastPhoto is a high-performance rescaling tool for photographic images. It can be installed on a web server as a handler for files of type image/jpeg, providing fast server-side resizing with (optional) transparent caching. It can also be used as a commandline application.

FastPhoto uses Epeg, a high-performance JPEG resizing library which decodes only the DCT coefficients needed to reconstruct an image of the desired size, and avoids colorspace conversions where possible.

FastPhoto preserves the aspect of the original file unless both width and height options are specified.

Usage

When FastPhoto is installed on a webserver, any URLs to JPEG files will automagically accept rescaling parameters such as:

<img src="myphoto.jpg&scale=20%"/>

or

<img src="myphoto.jpg&width=120" width="120"/>

This makes it trivial to generate web pages containing thumbnails of full-sized photos:

<a href="myphoto.jpg"><img src="myphoto.jpg&width=120" width="120"/></a>

With FastPhoto installed on a web server, a photo gallery application does not need to worry about generating thumbnails; it need only generate the HTML necessary to view and navigate images. The required thumbnails will be generated on demand, and popular thumbnails will be transparently cached on disk.

Options

The following URL query parameters are available:

width=... Image width (pixels)
w=...

height=... Image height (pixels)
h=...

scale=... Scaling (percentage)
s=...

quality=... Compression quality (percentage)
q=...

gray Convert to grayscale
grey

These may be used in combination, eg:

<img src="myphoto.jpg?width=120&quality=60&gray" width="120">

If only one of width or height is specified, the aspect ratio of the image is preserved. If scale is specified, it overrides the value of width or height.

Server configuration

The following configuration for Apache httpd will enable FastPhoto. As with most Apache directives, this may of course be restricted to particular Directories or Locations:

ScriptAlias /fastphoto /usr/local/bin/fastphoto
Action image/jpeg /fastphoto

To enable caching, create a directory /var/cache/fastphoto and make it writeable by the web server process.

HTTP/1.1 Cacheability

FastPhoto generates Content-Length and Last-Modified HTTP headers, and responds correctly to If-Modified-Since conditional GET requests.

Commandline utility

FastPhoto can also be invoked from the commandline, as fastphoto. Its options are similar to the URL query parameters; fastphoto --help provides usage information. For complete details, see the fastphoto man page.

Download

FastPhoto is distributed in source form here (fastphoto-0.9.0.tar.gz).

Development

FastPhoto is maintained in git at http://github.com/kfish/fastphoto:

git clone git://github.com/kfish/fastphoto.git

License

Copyright (C) 2006 Conrad Parker <conrad@vergenet.net>

Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.

Contact

Please direct any queries, bug reports etc. about FastPhoto to the author, Conrad Parker conrad@vergenet.net .

Copyright © 1995-2010 Conrad Parker <conrad@vergenet.net>. Last modified Fri Apr 16 2010