#!/usr/local/bin/perl # kphoto.cgi - build virtual photoalbums from directories of images # # by Kirk Israel # This script is offered as e-mail-me-ware: if you use it, send # e-mail to kisrael@alienbill.com . Enhancements/Suggestions welcome. # # # When placed in a directory (either literally or as a symbolic link) # makes a clickthrough slideshow for all the # *gif, *jpg, *jpeg (case insensitive), with the options of viewing # all images on a page. # # HINT: CALL THIS SYMLINK "index.cgi" AND ON MANY SERVERS IT WILL ACT # AS THE DEFAULT "index.html" FOR THE DIRECTORY # # There is a related editkphoto.cgi script that allows you to # edit captions for each images, as well as a title for the photoalbum # and text for the album's "splash page". Simply (temporarily?) put # that script (or symlink it) in the same directory as the photos # and this script and make sure it the script has permission to write # to a file "kphoto.info" in the directory # # Also, if you have a directory "full/" in that directory, and it has # files to larger versions of the image files with the same name, # it will make links to the big versoin print "Content-type: text/html\n\n"; chugCGI(*input); #read in all the image files, sort opendir(READ,"."); while($nextfile=readdir(READ)){ if($nextfile =~ /\.(jpg|jpeg|gif)$/i) { push @pixname, $nextfile; } } closedir READ; @sortpix = sort @pixname; #load captions, title, etc readInfo(); $view = $input{"view"}; $title = $info{"title"}; $splashpage = $info{"splashpage"}; if($title eq ""){ $title = "k/photo"; } print<<__EOQ__;