Pagemunger
----------
This is a set of Perl scripts for maintaining a photo album on the Web.

#  Copyright (C) 2003 Anthony de Boer
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of version 2 of the GNU General Public License as
#  published by the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Assumptions:

  You have shell access, and you'd rather use that than some interactive
  webbish thing.  You can of course build webpages on one machine and
  rsync them to the live server.

  Static pages will be built indexing and thumbnailing the photo
  collection.

  Captions and other notes are optional.

  Access control can be handled by doing htpasswd stuff on the photo
  directory.  Multiple layers of control would be handled by having
  multiple directories with different security policies for each.
  There is support for generating symlinks in various directories
  pointing to the actual images in a master directory.  This assumes
  something like the thttpd security model, where a symlink is not
  chased to determine if the user has permission in the directory in
  which the symlinked file really lives.

1. pagemunger

Takes no arguments.  Looks for a .data file in the current directory,
and for jpg/jpeg/gif/png files.  May add entries to .data, generating
a new file.  Generates various html pages and thumbnail images.
Thumbnails files are prefixed with ".t_" so that the files won't show
up with a normal ls, or to tools like gqview.

The .data file is paragraph-parsed.  An empty line separates entries,
and whitespace separates tokens in an entry.  Typical entries include:

  pageid seqno imagename.jpeg {optional caption text}  -- says that
  the named image is on pageid at position seqno.  Pageid is an
  alphanumeric identifier, one per set of pictures.  Seqno is a
  sequence number, integer, and they don't have to be consecutive.
  Think BASIC-program line numbers.  Caption text would follow but is
  optional.

  _ imagename.jpeg WIDTH=xxx HEIGHT=yyy  -- these entries are autogenerated
  to cache information that makes the generated HTML more efficient.
  Ignore them unless you just resized an image and need to elide the
  existing cache information for it and its thumbnail.  Delete the
  thumbnail itself to get a new one made.

  pageid title Title Text -- Sets the title for the named page.

  pageid intro Introductory Text -- Adds text to the top of the index
  page before the pictures.

  pageid tail Trailer Text -- Adds text to the end of an index page.

  index auto yes -- autogenerates an index.html page.

Note that intro and tail entries especially may be multiple lines long
in the .data file.  Use HTML markup appropriately.

There are two major modes.  If none of the pictures have captions, then
there's just one HTML page generated, with all the thumbnails multiple
to a line, and linking directly to the fullsize images.  If any captions
are found, then the thumbnails run vertically with captions beside them,
and each links to an HTML page with the fullsize image and caption and
appropriate interpage links.

If there's just one set of images in a directory, then using "index" as
pageid will generate an index.html and the right thing follows from
that.  Otherwise, "index auto yes" will generate an index.html pointing
to all the pageid pages in the directory.

It'll generate an unsorted.html pointing to any images not otherwise
accounted for in .data.

Examples:

  http://www.leftmind.net/~adb/treb/.data
  http://www.leftmind.net/~adb/ols2001/.data

2. galleryexport pageid [pageid...]

Generates symlinks and .data entries in the current directory pointing
to the master directory, whose path must be in the environment as
GALLERY.  Make any .data adjustments then run pagemunger.

3. galleryaudit

Reports on which pageids are and aren't in the current directory.

4. pagesequence

Generates a report on the master archive.  Assumes pictures are in the
img_NNNN.jpg format that Canon uses.

5. unpic

Removes a bad image.  Assumes img_NNNN.jpg format and requires just the
NNNN on the commandline.

