Philip Guo (Phil Guo, Philip J. Guo, Philip Jia Guo, pgbovine)

Gallery Lite: Yet Another Lightweight Web Photo Gallery Generator

No fuss ... here's the code!

Let's say that you have several directories of full-sized lots-of-megapixel digital camera photos uploaded to your server, and you want people to be able to see thumbnail previews of these photos before selecting which ones to download (because it's pretty slow to click on high-resolution photos and wait for them to load completely). What do you do?

  • generate-gallery.py takes as input a list of sub-directories containing JPEG photos and creates pretty thumbnails and 800x600 mini-sized photos in a separate gallery-lite/ sub-directory (so your original photo archive directories are untouched) as well as an XML file that represents the contents of the newly-generated gallery. Its only dependency is the Python Imaging Library (PIL).

  • galstyle.xml is an XSLT stylesheet that makes the output XML gallery file from generate-gallery.py look like a simple gallery with tables of thumbnails. Run something like xsltproc to generate an .html file if you'd like.

  • wz_tooltip.js is a cool JavaScript hack (not written by me) that allows the gallery to have pop-up tooltips appear when the user does a mouseover on the thumbnails. I use these tooltips to display the image filename and date.

  • Optionally, you can get gal.dtd to validate the XML gallery files, if you're into that sort of thing.

This was just a quick-and-dirty hack, so I'm not putting lots of effort into documentation :) Have fun, and email me if you have any questions or concerns.

Created: 2007-01-07
Last modified: 2007-01-07
Related pages tagged as software: