# # remkhtml.pl - create framesets for digital pictures # Copyright (C) 2002 - Anthony Tonns # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # --- # # ATonns Tue Jun 18 23:40:00 EST 2002 # do all image processing # # ATonns Sat Jul 27 09:48:00 EST 2002 # made more Win32/UNIX portable # # ATonns Sun Sep 22 16:25:00 EDT 2002 # gutted all.pl just to make HTML # # what remkhtml.pl does is re-create the HTML files # (in html dir) for each pic and re-generate left.html with # preview of each thumb. this is basically step 5 of # all.pl all over again, but if you've flipped images # left or right, you need to remake the HTML to get the # sizing done with Image::Size right. # use strict; use Image::Size; # program names, etc. for Win32/UNIX portability my $mogrify="C:\\progra~1\\ImageMagick\\mogrify.exe"; my $copy = "copy"; my $move = "move"; my $dirsep = "\\"; my $ext = "JPG"; my $prev_index = "index.html"; # size to create images for viewing my $image_width = "640"; my $image_height = "480"; my $image_size = "${image_width}x${image_height}"; # size to create thumbnails for previewing my $thumb_width = "128"; my $thumb_height = "128"; my $thumb_size = "${thumb_width}x${thumb_height}"; # simple subroutine to execute system calls (or easily not run them) sub runme { my $runme=join(" ",@_); print "$runme\n"; system("$runme"); } if ( ! -d "images" ) { print STDERR "whoops - i need an 'images' directory \n"; exit(1); } if ( ! -d "html" ) { print STDERR "whoops - no 'html' directory (where will i put this stuff??)\n"; exit(1); } # get a list of image files (ONLY! no movies here) chdir "images"; my @files = glob "*.$ext"; chdir ".."; # create the thumnail nav bar (L) my $prevname = ""; open(L,">left.html"); print L qq!\n!; print L qq!\n!; print L qq!left\n!; print L qq!\n!; print L qq!\n!; print L qq!\[Up\]
\n!; while ($#files >= 0 ) { my $file = shift(@files); my ($thisname,$ext1) = split(/\./,$file); my $next = $files[0]; my ($nextname,$ext2) = split(/\./,$next); print qq!"$thisname" -> "$prevname" and "$nextname"\n!; # create the page the image is viewed on open (F,">html/$thisname.html"); print F qq!\n!; print F qq!\n!; print F qq!$thisname\n!; print F qq!\n!; print F qq!\n!; # since the navigation string is both at the top and bottom, # just store it in a variable now for dual usage later my $navstring = ""; # if there's a previous, make it a link $navstring .= qq!\[!; if ( $prevname ne "" ) { $navstring .= qq!!; } $navstring .= qq!Prev!; if ( $prevname ne "" ) { $navstring .= qq!!; } $navstring .= qq!\] !; # go up to main page $navstring .= qq!\[Up\]!; # view the raw photo $navstring .= qq!\[Raw\]!; # if there's a next make it a link $navstring .= qq!\[!; if ( $nextname ne "" ) { $navstring .= qq!!; } $navstring .= qq!Next!; if ( $nextname ne "" ) { $navstring .= qq!!; } $navstring .= qq!\] !; $navstring .= qq!
!; # print the guts of the page print F qq!$navstring\n!; # if there's a next, make it a link if ( $nextname ne "" ) { print F qq!!; } my($width,$height) = imgsize("images/$file"); print F qq!!; if ( $nextname ne "" ) { print F qq!!; } print F qq!
\n!; print F qq!$navstring\n!; print F qq!\n!; print F qq!\n!; close F; print L qq!!; my($thumbwidth,$thumbheight) = imgsize("thumbnails/$file"); print L qq!
\n!; $prevname = $thisname; } print L qq!\[Up\]
\n!; print L qq!\n!; print L qq!\n!; close L;