#! /usr/local/bin/perl $maxWidth = "750"; $layout = "alternate"; $showDividers = 1; if (-f "album.props") { open (PROPS, ") { eval ($_); } close (PROPS); } opendir (DIR, "."); @files = readdir(DIR); closedir (DIR); print "Content-type: text/html\n\n"; if (-f "HEADER.html") { open (HEADER, ") { print; } close (HEADER); } else { print "\n"; print "
\n"; } $count = 0; print "\n"; if ($showDividers) { print "\n"; } foreach $file (sort @files) { next if ($file !~ /.txt/ && $file !~ /.jpg/); next if ($file =~ /-large.jpg/); next if ($file =~ /thumbnail/); if ($file =~ /.txt/) { $img = $file; $img =~ s/.txt/.jpg/; } else { $img = $file; $file =~ s/.jpg/.txt/; } next if ($processed{$file} == 1); $processed{$file} = 1; $large = $img; $large =~ s/.jpg/-large.jpg/; # Generate the picture display $picture = ""; if (! -f $large) { $picture .= ""; } else { @stats = stat($large); $size = int($stats[7]/1024); $picture .= "

"; $picture .= "
"; $picture .= ""; $picture .= "
"; $picture .= "Click Photo For Enlargement ($size Kb)"; $picture .= ""; $picture .= "
"; } print "\n"; print "\n"; print "\n"; # for text only, print it acros the whole page if (-f $file && ! -f $img) { print "\n"; # for picture only, print it centered across the page } elsif (! -f $file && -f $img) { print "\n"; # for text and picture, alternate if specified } else { if ($layout eq "left" || ($layout eq "alternate" && $count == 0)) { print "\n"; print "\n"; } else { print "\n"; print "\n"; } } print "\n"; print "
\n"; &printText($file); print "$picture$picture\n"; &printText($file); print "\n"; &printText($file); print "$picture
\n"; print "\n"; if ($showDividers) { print "
\n"; } if (-f $img) { $count = 1 - $count; } } print "\n"; if (-f "FOOTER.html") { open (FOOTER, ") { print; } close (FOOTER); } else { print "
\n"; } sub printText { my ($file) = @_; print "
\n"; open (TXT, "<$file"); while () { print; } close (TXT); print "
\n"; }