#!/usr/bin/perl ## Given the directory of images, a show title, and a file ## containing the image file names, orientation (l or p ## for landscape or portrait), and caption ## (one on each successive line, e.g.: ## foobar.jpg ## p ## This is a great moment when foo jumped the bar. ## ) ## this Perl script builds a slide show for display (custom color ## background, with table of contents...) as a set of web pages ## ## ## SRV Oct. 5, 1998; SRV Aug 6, 1999 $pagecolor="black"; $imgdir="img"; $title="The Sea Education Association"; $home_url="../index.html"; $home="Cramer Home Port"; $shrinkfactor="20"; # percentage shrink from init img to thumbnail #$bigdim="320"; #$smdim="240"; $bigdim="480"; $smdim="360"; #$bigdim="640"; #$smdim="480"; $sqrdim="275"; # img display size in pixels `mkdir thumb`; `mkdir html`; # Get list of img file names # NOTE: EXPECTS FILES TO BE NAMED LIKE: FILENAME.JPG open(MASTER, "contents.html") || die print "Can't open contents file!\n"; print (TOC "\n\n\n$title Slide Show Table of Contents\n"); print (TOC "\n\n"); print (TOC "\n

$title Slide Show

\n\nClick on any image to begin the show...

"); ## Loop through all files in the specified image directory ## and create slides in directory where script is run $prev="../contents"; $firstimg=; chop($firstimg); $firstorient=; chop($firstorient); $firstcaption=; chop($firstcaption); $imgname=$firstimg; $orient=$firstorient; $caption=$firstcaption; while () { # print "$orient "; $nextimg=$_; chop($nextimg); $nextorient=; chop($nextorient); $nextcaption=; chop($nextcaption); `convert -size $shrinkfactor%x$shrinkfactor% img/$imgname thumb/$imgname`; print (TOC ""); print (TOC ""); print (TOC "\n"); # Create the slide for current image... open(SLD, ">html/$imgname.html") || die print "Can't open $imgname.html!\n"; print (SLD "\n\n\n$imgname Slide\n\n\n"); print (SLD "\n\n"); print (SLD "

Previous | Contents | Next

\n"); if ($orient eq "l") { print (SLD "

\n"); print (SLD "

$caption



") } elsif ($orient eq "p") { print (SLD "

\n"); print (SLD "$caption



") } else { print (SLD "

\n"); print (SLD "$caption



") } print (SLD "\n\n

Previous | Contents | Next

\n

\n\n\n"); close (SLD); $prev=$imgname; $imgname=$nextimg; $orient=$nextorient; $caption=$nextcaption; } #Don't forget to print out the slide for the last img! `convert -size $shrinkfactor%x$shrinkfactor% img/$imgname thumb/$imgname`; print (TOC ""); print (TOC ""); print (TOC "\n"); open(SLD, ">html/$imgname.html") || die print "Can't open $imgname.html!\n"; print (SLD "\n\n\n$imgname Slide\n\n\n"); print (SLD "\n\n"); print (SLD "
Previous | Contents | Start Over

\n"); if ($orient eq "l") { print (SLD "

\n"); print (SLD "

$caption



") } elsif ($orient eq "p") { print (SLD "

\n"); print (SLD "$caption



") } else { print (SLD "

\n"); print (SLD "$caption



") } print (SLD "

Previous | Contents | Start Over

\n

\n\n\n"); close (SLD); print (TOC "

Return to $home\n\n"); close(TOC); close(MASTER);