A few years ago, my friend Andrew bought a digital camera and wrote a simple photo gallery CGI in Perl. I liked it, and used it for a while. After a while, I made some modifications to change his POST requests (intended to hide photo filenames for security) with GET requests to allow me to easily share photos with friends by URL.
Later on, I decided to spend an evening and completely re-write the software, giving a slightly different user interface, and with a different back-end directory structure. My software isn't any more advanced than Andrew's but it meets my needs better.
Make sure you've got NetPBM, Perl5, CGI.pm, Image::Info, and URI::Escape.
For version 1.5 and up, you need a tree like this:
photos photos/index.cgi (included in archive) photos/.header.html (ditto) photos/.footer.html (yup, included) photos/Gallery 1/lotsofpics.jpg photos/Gallery 1/.rotation (optional) photos/Gallery 1/.descriptions (optional) photos/Gallery 1/.startatlast (optional) photos/Gallery 2/lotsmorepics.jpg
The names of the photo directory and galleries directories are arbitrary; the software doesn't care what they're called.
When a user first views the images, lowres and thumbnail directories will be automatically created and lowres and thumbnail versions of the images will be generated and cached. Check your server logs for this stage the first few times to make sure all the tools have been found and are working. If you remove photos, the cached lowres and thumbnail versions will be cleaned automatically.
Edit the .header.html
and .footer.html
files
to your preferences if you want to set up some CSS stuff or set the
background colour of the page or something.
Create the optional file ".rotation" in each gallery directory with the following format:
FILENAME DEGREES_TO_ROTATE
The previews.cgi script will rotate the low-res preview and thumbnail images appropriately.
Create the optional file ".descriptions" in each gallery directory with the following format:
FILENAME Description of the image
NOTE: The image filename should not contain spaces. This is because my scripts make stupid assumptions.
Adjust your web server to make index.cgi the default page for that directory, and you should be all set!
None. Public domain. No GPL virus.