CD Gallery (V1.3)

I've been using Gallery to organize my digital photographs. It works really well, and I'm quite happy with it.

Happy, that is, until I wanted to send a set of party photographs to one of my cousins on a CD-ROM. Suddenly, the limitations of a web-server based system became apparent. I suppose I could have uploaded my photos to one of the many online album-sharing services, but I'm not happy with the license agreements those entail. I could have uploaded them to my own web server, but that would have required almost 600Mb of disk space and, well, that's a lot of space. Besides which, it would have been tedious for my cousin to copy all those photos to her machine. Assuming she has that much disk space.

No, what I really wanted was a “snapshot” of my gallery, suitable for burning on a CD. With a little help decoding the album data format from Bharat Mediratta, a little Perl, and a little XSLT, that's what I've got.

This seems like a generally useful thing, so I'm posting my scripts and stylesheets here. These work for me, but you may need to fiddle a bit to get them working for you. They're not (yet) well documented, so feel free to ask if you have questions.

Changes in V1.3

This release adds support for the new database formats used in Gallery V1.3.2. It still supports the older Gallery 1.2.x database formats, but there's no need to upgrade if you haven't upgraded your Gallery system.

Changes in V1.2

A number of improvements and bug fixes have been made since the 1.0 and 1.1 releases. Charles Lesburg inspired or implemented most of them. Thanks, Charles!

gallery2xml

  • Added -v option. It's really just for debugging, but there you go.

  • Search for entries in the items array rather than assuming they'll be in fixed locations.

  • Skip exif comments; they contain random binary data.

  • Use UTF8 for encoding data in XML.

duptree.xsl

  • Correctly handle the fact that the stylesheet deals with “pages” of images; don't output multiple mkdir or cp commands.

htmltree.xsl

  • Support Saxon, EXSLT, and Xalan for chunking the pages.

make_static_gallery.csh

  • New script, written by Charles, to automate the process a bit.

How to Build a CD Gallery

Building a static snapshot of an album is a multi-step process. I'm assuming here that you can login to the server where the album exists and run these commands on that machine. If you don't have shell access to the machine where your server is, you'll have to FTP the album.dat files and the images to a local machine before you begin.

  1. Select the album you want to process and run gallery2xml:

    gallery2xml -b /path/to/albums -o album.xml albumName
    

    The resulting XML file (album.xml) contains an XML representation of the album data.

    If the album selected contains nested albums, all of the nested albums will also be processed automatically.

  2. Create a copy of the album data. I'm reluctant to work directly in the gallery directories for fear I'll mangle something, so I always work on a copy. If you have write access to all of the directories created by the Gallery software, you can skip this step.

    The duptree.xsl script creates a shell script that contains all of the appropriate copy commands.

    You must specify several parameters when you process the XML file with this stylesheet:

    base

    Must be set to the base directory of your albums. This is the same as the -b parameter of gallery2xml. This path must end with "/".

    root

    Must be set to the root of your temporary location. This path must end with "/".

    dup

    Specifies the command used to create copies. It's “cp” by default. Change it to “ln -s” if you want to make links instead of real copies. You'll probably have to change it to “copy” on Windows systems.

    After you run the stylesheet, review its output and if your content that it's correct, run the script it produced to copy your album data.

  3. Create static web pages for all of your album directories.

    The htmltree.xsl script performs this task. This stylesheet requires an XSLT processor that understands the EXSLT extensions (Saxon and xsltproc both do).

    You must specify several parameters when you process the XML file with this stylesheet:

    base

    Must be set to the base directory where you will be creating the files. This is same as the root of duptree.xsl, if you created a temporary copy. This path must end with "/".

    css

    Specifies the location of the CSS file to use for album pages. This defaults to ../album.css.

    There are a number of other parameters you may want to change, take a peek in the stylesheet.

  4. Copy album.css (unless you specified an alternate CSS file) to the root of your temporary location.

  5. Copy the images directory to the root of your temporary location.

  6. Create a top-level index.html file in the root of your temporary location that points to your album root page(s).

That's it. If you load up your top-level index.html page, you should be able to link to all of the images in all of your albums.

Charles Lesburg contributed make_static_gallery.csh to automate this process.


 


 Updated: Mon, 06 Oct 2003
 [Website]
 
Home Feedback  
Copyright © 1997-2005 Norman Walsh.