"; } print <END_OF_TEXT for (1..$indent) { print ""; } print 'Click on any of the pictures to enlarge them to their original size. Photoalbum.cgi page generator script $version (c) 2007 by David Porter.
END_OF_TEXT
print "$title |
"; } print ''; print $htmlheader; if (-e $captions) {} else { print "Warning: Captions file $captions not found...now scanning for jpgs
"; $captions = 0; $scanall = 1; $sort = 1; $nosort = 0; } if ($chaptercount > 1 && !$suppresschapters) { $i = 0; print "Chapters:"; foreach(@chaptertitle) { ++$i; if ($i != $targetchapter) { print '
', $_, ""; } else { print "
", $_, ""; } } print ""; } # 2nd scan of Captions.txt or $captions file, to pick up JPG names if (-e $captions) { open (F, $captions) || dienice; #Open captions file $lineinput = 0; if ($chaptercount) { $chapterstartsat = $chapterstarts[$targetchapter-1]; } else { $chapterstartsat = 0; } while (
"; $i = 0; foreach $n (@iterate) { $i++; print "\n) { $line = trim($_); ++$lineinput; if (length $line == 0) {} elsif ($lineinput > $chapterstartsat) { if ($line =~ /\*CHAPTER/i) { last; } #hit chapter boundary elsif ($line =~ /^\*{1}/ ) {} #some other command else { #otherwise it's a picture reference if (($j = index(uc $line, ".JPG")) > -1) {#if jpg in it $s[0] = substr($line, 0, $j+4); $s[1] = substr($line, $j+5); } else { @s = split /\s{1}?/, $line; #else split on space foreach (2..$#s){ $s[1] = $s[1]." ".$s[$_]; } $s[0] = $s[0].".jpg" } foreach (@results) { #adjust case if needed if (uc $_ eq uc $s[0]) { $s[0] = $_; last; } } if (exists $H{$s[0]}) {} else { $H{$s[0]} = $s[1]; push @iterate, $s[0]; } } } } close F; } if ($scanall) { #no caption file--scan only. foreach (@results) { $i = $_; if (exists $H{$_}) {} else { $H{$i} = $i; } } } #sorting occurs here if (length $captions) { if ($sort) { @iterate = sort {$aa = substr($a, 0, index(uc $a, ".JPG")); $bb = substr($b, 0, index(uc $b, ".JPG")); if ($aa =~ /^\d*$/ && $bb =~ /^\d*$/) {return $aa <=> $bb;} elsif ($aa !~ /^\d*$/ && $bb =~ /^\d*$/) {return 1;} elsif ($aa =~ /^\d*$/ && $bb !~ /^\d*$/) {return -1;} else {return lc $aa cmp lc $bb;} } keys %H; } else { # @iterate = keys %H; ########### } } else { if ($nosort) { # @iterate = keys %H; ############ } else { @iterate = sort {$aa = substr($a, 0, index(uc $a, ".JPG")); $bb = substr($b, 0, index(uc $b, ".JPG")); if ($aa =~ /^\d*$/ && $bb =~ /^\d*$/) {return $aa <=> $bb;} elsif ($aa !~ /^\d*$/ && $bb =~ /^\d*$/) {return 1;} elsif ($aa =~ /^\d*$/ && $bb !~ /^\d*$/) {return -1;} else {return lc $aa cmp lc $bb;} } keys %H; } } if ($#iterate =~ -1) { print "No jpg files found...ending script."; exit; } print " "; print ""; print <
END_OF_TEXT $_ = $n; s/\\/\//; print ""; print ' '; print ''; $c = $H{$n}; print ''; if (length($c) > 0) { print " $c"; } else { print "No caption supplied for ", $n, "."; } print "
", $htmlfooter; print "