#!/usr/bin/perl #---------------------oOo------------------------- # Filename: mkindex.pl # Usage: ./mkindex.pl [-][t|r|c] filename1.jpg filename2.tif # the output will be filename1.jpg filename2.jpg # index.html, filename1.html and filename2.html will be generated # Coder: Tuan Trung Pham # Last update: June 24, 2002 1st release # 12/31/02 added -t, -r # 01/03/02 improved parsing -t -r # 01/04/02 added sharpen, unsharp mask, and beginning year for (c) # 01/05/03 fixed parsing the title w/ html tags # 04/05/03 fixed invalidate html tags # 05/18/04 removed profiles so that old IEs can display images # 06/13/06 added website URL # 03/31/08 added Previous and Next link # 11/24/11 added "Up" link, removed tabs, corrected scale # -t="myfile.info" # filename\ttitle description #.... # -r dont need to resize the input files, just generate html files # -c=yyyy begining year for (c) => (c)yyyy-currentYear # Requirements: # 1) convert ( from ImageMagick Studio package) # 2) perl # 3) decent OS (*ix) # 4) a lot of image files (tif, jpg, png....) # Wish list: # 1.caption info (the next row after title and (c)) # 2.recursive directory # 3.copy right tag (check out JWZ's code) $Site="http://photo.neofob.org"; $ParentDir="../index.html"; $NAME="Tuan Pham"; # put your darn name here $IndexFile=""; $Title=""; @FILENAME,@TITLE, $inputFile; # filename and title array %Table; main(); #--------------------------oOo--------------------------- # the job is done mainly by this subroutine => main() sub main { my $Body,$LastFile,$AFile,$NextFile,$OutFile,$ThumbNail,$CurrentFile; my $i=0; my @A_PARA; my $t=0,$r=0; my $bYear=""; $LastFile="./index.html"; $NextFile="./index.html"; mkdir "tn" unless ( -e tn ); # creates the directory for thumbnails # parse -t and -r while ($i<3) { @A_PARA=split("=",@ARGV[0]); # parse the first argument for (@A_PARA[0]) { /-t/ and do { $t=1; $inputFile=@A_PARA[1]; makeHashTable(); shift(@ARGV); }; /-r/ and do { $r=1; shift(@ARGV); }; /-c/ and do { $bYear=@A_PARA[1]; shift(@ARGV); }; } # for $i++; } # while $i=0; makeHeader(); $Body="
| \n".
" ".
" | \n";
$LastFile=$CurrentFile;
}
else
{
print STDERR "Broken arrow! Broken arrow! \"$NextFile\" doesnt exist!\n";
}
} # while loop
# wrap up the tail
$Body=$Body."
| \n". " | \n". "
| \n".
" ";
chomp $Year;
if ("" eq $bYear)
{
$IndexFile.="©$Year $NAME \n"; } else { $IndexFile.="©$bYear-$Year $NAME \n"; } $IndexFile.=" Any unauthorized use of these photos will be prosecuted to full extent\n". "of the current complicated Federal Copyright Laws.\n". " \n". " | \n".
"
| Home | \n". "