Ken, I use my own perl script to index photos. Here it is. As for a starter motor, I think that all my motored stuff works well by now...
====================================================================== #!/usr/bin/perl
sub index_dir { my $dirname = shift @_; my $title = shift @_ || "\u$dirname"; opendir( DIR, $dirname );
print STDERR "Indexing '$dirname'...\n";
# system( "mv -f index.html index.html.old" ); # system( "mv -f full.html full.html.old" ); print "opening $dirname/index.html\n"; open( INDEX, ">$dirname/index.html" ) || die "cannot open index.html"; open( FULL, ">$dirname/full.html" ) || die "cannot open full.html";
my $prefix = " $title "; $prefix .= "$title\n\n" if $title ne "."; $prefix .= "Click on the thumbnail images to enlarge\n"; print INDEX $prefix;
my $intro = "$dirname/intro.txt"; if ( -r $intro ) { open( INTRO, $intro );
while ( ) { s/CURRENT_DIRECTORY/$ENV{'URL'}/g; print INDEX; } }
if ( !$with_pix ) { print INDEX "This is the index of pictures. Click here to see all of them at once. (takes a while to load.\n"; }
print FULL $prefix . "This is the full index of pictures. Click here for the filename list (fast loading.\n\n";
my @files = (); my @subdirs = ();
my $fn;
while ( $fn = readdir( DIR ) ) { if ( ($fn =~ /^(.*)\.jpg$/i || $fn =~ /^(.*)\.jpeg$/i || $fn =~ /^(.*)\.gif$/i ) && !($fn =~ /^-/) ) { my ($dev, $ino, $mode) = stat( "$dirname/$fn" ); if ( $mode & 0x04 ) { # readable by world push @files, $fn; }
} elsif ( -d "$dirname/$fn" ) { if ( !($fn =~ /^\./) ) { push @subdirs, $fn; } } }
my $start = ""; if ( $dirname ne "." ) { $start = "Back\n"; }
foreach $fn (sort @subdirs) { $start .= " \u$fn\n"; } print INDEX $start;
foreach $fn (sort @files) { if ( ($fn =~ /^(.*)\.jpg$/i || $fn =~ /^(.*)\.jpeg$/i || $fn =~ /^(.*)\.gif$/i) && !($fn =~ /^-/) ) { $name = $1; } my $text = ""; if ( open( ANNOTATION, "$name.txt" ) ) { while ( ) { $text .= $_; } close( ANNOTATION ); } else { $text = $fn; }
if ( $with_pix ) { my $tn = "-THUMBNAIL.$fn"; if ( ! -f "$dirname/$tn" ) { print "Converting $fn to $tn...\n"; system( "convert -geometry 20%x20% $dirname/$fn $dirname/$tn" ); } if ($text ne $fn ) { print INDEX "$text\n\n"; } else { print INDEX "\n\n"; }
} else { print INDEX "$fn\n\n"; if ( $text ne $fn ) { print INDEX $text . "\n\n"; } } print FULL "$text\n\n"; #print "Processed $fn...\n"; }
close( INDEX ); close( FULL ); closedir( DIR );
foreach $fn (sort @subdirs) { index_dir( "$dirname/$fn" ); }
}$url = $ENV{'URL'};
$with_pix = 0; if ( @ARGV[0] eq '--with-pix' ) { shift @ARGV; $with_pix = 1; }
index_dir( ".", @ARGV[0] );