#!/usr/bin/perl use CGI (-debug); use strict; chdir "/home/davei/public_html/pics"; my $q = new CGI; my $message; my $subdir = $q->param('dir'); if ($q->param('getme')) { chdir $subdir; if ((int($q->param('xres')) >= 0) || (int($q->param('xres')) >= 0)) { print $q->header('image/jpeg'); my $convertFile = "fullsize/".$q->param('getme'); my $convertOpts; $convertOpts = "-geometry "; # $convertOpts = "-geometry " if ($q->param('aspect')); $convertOpts .= join("x", $q->param('xres'), $q->param('yres')); open (CONVERT, "/usr/pkg/bin/convert $convertOpts $convertFile - |"); while () { print; } print STDERR "subdir = '$subdir' file = '$convertFile'\n"; print STDERR "path = ",`pwd`,"\n"; print STDERR "command = 'convert $convertOpts $convertFile -'\n"; exit(0); } $message = "Invalid resolution, please try again."; } print $q->header, $q->start_html(-title=>'Dave\'s Pics Browser', -BGCOLOR=>'#000000', -TEXT=>"#D0D0D0", -LINK=>"#00FFFF", -VLINK=>"#8080FF"); unless ($subdir) { print qq!

My Pictures

These are pictures I have taken and scanned, or taken via digital camera. They are in the order they were added (not necessarily the order they were taken.)
Choose a CollectionHow Many per Screen
!; exit; } chdir $subdir; my @files = `ls -rt fullsize/`; my $startPic = $q->param('startpic'); my $picsPerPage = $q->param('pppage'); my $lastPic = $startPic + $picsPerPage - 1; my $picNumber; if ($lastPic > $#files) { $lastPic = $#files; } if ($lastPic < $startPic) { print $q->h1("No more pictures to display, sorry."); } else { if ($message) { print "

$message

"; } print "

Pictures $startPic - $lastPic of $#files:

\n"; print ""; for ($picNumber = $startPic; $picNumber <= $lastPic; $picNumber++) { print "\n!; } print "
 "; my $fileName = $files[$picNumber]; chomp $fileName; my $commentName = $fileName; $commentName =~ s/JPG$/txt/; $commentName =~ s/jpg$/txt/; if (open(COMMENTS,"< comments/$commentName")) { while () { print; } close(COMMENTS); } print qq! Download this image at resolution:
x
!; # Apparently not necessary #  Preserve aspect ratio print qq!
$fileName
\n"; } if ($lastPic < $#files) { print "!; print "
\nGet next pictures:\n"; print qq!
!; print qq!!; print qq!
\n"; } print "
"; print qq! Go back to the beginning of the list
Go back to the opening page!; print $q->end_html;