#!c:/perl/bin/perl ################################################################### # A small cgi script to display photos # # Written by Joe Kamphaus May 2006 # # Program expects a directory tree of photograghs in jpeg format # # with the thumbnails in a directory named thumbs # # Example of tree: # # Photos # # Vacation # # file01.jpg # # thumbs # # file01.jpg # ################################################################### use CGI; $q = new CGI; $folder = $q->param('dir'); $pic = $q->param('file'); print "Content-type: text/html\n\n\n"; ################################################################ # Change $relative_path to point to your photos root directory # ################################################################ $relative_path = "c:/Program Files/Apache Software Foundation/Apache2.2/htdocs/photos/"; ########################################## # Change this section to suit your needs # # Start ################################## ########################################## print ' Joe and Wilma at home Photographs

'; ################################ # Do not edit these lines # $folder = uc $folder; # print "$folder

"; # ################################ print '
Home Joes Stuff Wilmas Stuff Photographs Play Solitaire
'; ########################################## # End #################################### ########################################## print '

'; $path = "$relative_path$folder"; if (-d $path) { opendir DH, $path; @files = readdir DH; closedir DH; if (-f "$relative_path$folder/$pic"){ foreach (@files) { next unless /jpg/; $prev = $now; $now = $next; $next = $_; if ($pic eq $now){ last; } } $now = $pic; print "\n'; print ''; print "\n" if ++$i % 5 == 0; } } } else { $path = $relative_path; opendir DH, $path; @dirs = readdir DH; closedir DH; foreach (@dirs){ next if /^\.\.?$/; $dir = uc $_; opendir DH, "$path$dir"; @files = readdir DH; closedir DH; foreach (@files){ next if /^\.\.?$/; $file = $_; last if $file =~ /jpg/; } print "\n"; print "\n" if ++$i % 5 == 0; } } print "\n
"; print ''; print ''; } else { foreach (@files) { next unless /jpg/; print "\n"; print '
"; print '
' . "$dir
";