Simple Gallery v2.0

A Simple HTML Gallery Generator

A quick way to generate an HTML-based gallery of your favorite digital images. Simple Gallery will:

  • Create an index page containing thumbnails of your pictures
  • Create a separate web page for each picture
  • Print each image's short caption and file size on the index page
  • Print each image's long caption on the individual image page
  • Use a different specified background tile for each collection
  • Use a "set name" to describe each image group
  • Insert explanatory text from an "about" text file into each set's index page
sgallery was created originally by James Garrett. Scot Hacker took over maintenance of sgallery June 2001 and added attributes/captioning, about text, set names, background selection, and regeneration/cleanup stuff.

Installation

Place sgallery.py in ~/config/bin.

sgallery is a Python script which relies on the ability to read BFS filesystem attributes. Install the Python scripting language and Chris Herborth's fsattr Python module.

Install thumber in ~/config/bin for actual thumbnail creation.

System Configuration and Preparation

sgallery uses short and long captions attached to your JPEG images. Short captions go on the index page, long captions on the individual image pages. You must use Be's Preferences | Filetypes to add these attributes to the JPEG filetype. If caption attributes are not found, sgallery will print "I have no caption" for each uncaptioned image.

In Filetypes, navigate to image/jpeg, click Add... in the Attributes section. Fill out the fields exactly as shown below. Do the same for the long caption attribute, but use IMG:long_cap rather than IMG:short_cap.

jpeg_caps.png

After adding the new attributes to your filesystem, add captions to your images by manipulating filesystem attributes. Double-click the "sample" folder to see these attributes in action. Edit captions directly in the Tracker. Run the sample command below to see how these translate into actual captions.

captions.png

Testing and Usage

Once you've done the above, open a Terminal and cd to this directory. Do NOT cd into the "sample" directory. The "sample" directory contains some sample images and a sample about file. There is also a "backgrounds" folder.

To test that you've got everything installed properly, paste this into the terminal:

sgallery.py sample 4 "Images from the Edge of Nowhere" fuzz1.jpg
This says to run sgallery on the folder called "sample", to use a 4-column layout on the index page, to use the phrase "Images from the Edge of Nowhere" as the set name, and to use "fuzz1.jpg" from the backgrounds folder as the background tile on all pages. In other words, the syntax is:

sgallery.py folder_name columns "Name for this Set" background_file

When the script is done, you should end up with "sample.html" in the current directory. Double-click this to see how it all fits together. You can now copy or move this file and the sample directory to any web server.

Important notes:

  • Always work from the parent of the directory that contains your images.
  • Always have a directory called "backgrounds" in the working directory.
  • Always put a text file called "about" in the folder that contains the images.
  • Always work with JPEGs. This version of sgallery does not handle other image formats.
  • There is almost no error correction in this version of the script. You must use all available command line parameters on each run.
  • If you use Tab Completion in the terminal Do not leave a trailing slash at the end of the directory name.
  • Don't like the HTML or layout? Edit sgallery.py - it's all fairly clear. Just remember to escape any quotes you need to use.

Many thanks Chris Herborth for all of his work on Python for BeOS and for the BFS Python modules. Many thanks to James Garrett and Chris Herborth for additional help with some of the trickier Python stuff. This script comes with no guarantees. Improvements and corrections welcome.