This program generates a set of web pages for viewing photos. Input is a plain text file. Output is a hierarchy of pages that: - are protected according to user groups on a per-picture basis - are customized for nice layout according to the current user's group - contain appropriately scaled and rotated full-size images with captions - include thumbnail previews with captions See the "Photographs" section of http://nick.duffek.com/ for an example of this program's output. Requirements ------------ - Perl - Apache supporting SSI (server-side includes, i.e. .shtml pages), .htaccess files, and URL rewriting - The GIMP (GNU Image Manipulation Program) Usage ----- 1. Copy your latest batch of photos to ~/pics/in/. 2. Add photo file names and captions as desired ~/pics/index.txt. 3. Run "picweb" to populate ~/pics/html/ with .shtml files, scaled .jpg files, and .htaccess files. 4. Upload ~/pics/html/ to your web server. rsync works well for incremental index.txt changes. 5. Include picgroups.shtml wherever you'd like your list of photo groups to be displayed. Normally, this is accomplished by adding the following line to a .shtml file, e.g. photos.shtml: <--#include "picgroups.shtml" --> Installation ------------ 1. Copy picweb to some directory in your PATH. 2. Copy scale.scm to your GIMP script directory, e.g. ~/.gimp/scripts/. Input File ---------- The input is a plain text file listing groups of pictures with captions, optionally interspersed with resolution, privacy, and rotation directives. It looks like this, without the 2 spaces at the beginning of each line: group <pic-file> <caption> <pic-file> <pic-file> <pic-file> <caption> <caption-continued> <pic-file> <caption> ... group <subdir> <title> ... "group <subdir> <title>" starts a new picture group that consists of all subsequent picture files until the next "group" line. The group's <title> appears with those of other groups in picgroups.shtml, and its <subdir> contains the group's picture files. "<pic-file> [<caption>]" adds picture file <pic-file> to the group started by the most recent preceding "group" line. If <caption> is specified, it applies to <pic-file> and all subsequent pictures in the group that lack a caption. Multi-line captions are specified by indenting the second and subsequent lines of the caption. The following directives may be inserted freely between the group and picture lines: res <res> Sets the maximum dimension of subsequent pictures to <res> pixels. If a picture is wider than it is tall, it's scaled to width <res>, otherwise it's scaled to height <res>. The special value "full" leaves pictures at their original resolution. rotate <degrees> Rotates subsequent pictures by <degrees>, which must be 0, 90, 180, or 270. priv <groups> Prohibits viewing of subsequent pictures by users not in <groups>, a space-separated list of group names. The special value "any" allows viewing by everyone. Real-life example, indented 2 spaces: res 640 group vacation-2003/grand Vacation 2003, Grand Canyon 20030926001.jpg Views from the south rim. The haze is smoke from a forest fire on the north rim. 20030926003.jpg 20030926006.jpg Fire on the north rim. 20030926007.jpg rotate 90 20030927001.jpg Sunset. rotate 0 20030928001.jpg A newt at the Apache Stables. priv friends family 20030928002.jpg Me on a horse. priv any 20030928005.jpg More canyon views. group vacation-2003/nariz Vacation 2003, Northern Arizona 20030929001.jpg Swimming hole en route from the Grand Canyon to the town of Sedona. 20030929003.jpg Apache ------ picweb expects Apache environment variable "REMOTE_PW" to contain ":group1,group2,...:", where group1, group2, ... are the groups of which the current user is a member. One way to accomplish that is as follows: 1. Create a password-style DBM database: dbmmanage /etc/apache/users adduser joe - friends,family 'Joe Schmoe' dbmmanage /etc/apache/users adduser min - friends 'Min Chu' 2. Create a placeholder /priv directory in your DocumentRoot: mkdir /var/www/priv cat > /var/www/priv/.htaccess <<EOD Require valid-user RewriteEngine On RewriteRule (.*) /env%{REQUEST_URI} EOD 3. Configure Apache to apply DBM permissions and set REMOTE_PW when in /priv: ServerName ... DocumentRoot ... RewriteEngine On RewriteMap groups dbm:/etc/apache/users RewriteRule ^/env/priv/(.*) /$1 [E=REMOTE_PW:${groups:%{REMOTE_USER}|any}] <Directory /> AuthName priv AuthType Basic AuthDBUserFile /etc/apache/users AuthDBGroupFile /etc/apache/users </Directory> <Directory /priv> Require valid-user </Directory> Author ------ Nick Duffek <nick@duffek.com> http://nick.duffek.com/ Comments and bug reports welcome.