A Smart Picture Album
By Randal L. Schwartz
One of the side effects of buying my first still camera in nearly two decades is that I started taking pictures of everything. One of the nice things about buying a digital camera is that I have the results immediately. The downside is that I take a lot of pictures and want to show them off, because I don't have to worry about the cost or time of having some silver-halide-coated emulsion turned into light and dark spots.
In my September 1998 column, I described a little tool to create thumbnails from a directory full of JPEGs (see "Manicured Thumbnails"). In the past few weeks, I've used this program to create thumbnails of the pictures I've taken with my new camera. But now I have hundreds of pictures in a given directory. People started complaining about how long it took to download even the thumbnails from my Web site, so I knew I needed another solution.
Luckily, I remembered that the number-one server, Apache (which happens to be on what my ISP uses), has the ability to have not only an HTML file for the index for a directory, but also a CGI script to do the indexing. This is triggered with either a .htaccess file or the configuration files containing a line such as:
DirectoryIndex /cgi/pictures
So I put that line into the .htaccess for my Pictures directory, which means that directory and all subdirectories now invoke the named CGI script whenever the directory itself is requested. Note that this does not invoke the CGI script for the files within the directory.<>