#!/usr/local/bin/perl -w
#set this to how many pics you want on each table row
my $per_row=4;
my $count=1;
my $side=0;
my @leftright=("LEFT","RIGHT");
open (INDEX, ">index.html") ||die "$0 cant open index.html for write:$!";
print INDEX <<"__EOF__";
picturess
__EOF__
#the file extension is case sensative
foreach (<*.jpg>) {
print "Processing $_\n";
$smalltarget="thumbnails/".lc($_);
print " Creating $smalltarget\n";
print `djpeg -scale 1/16 $_ | cjpeg -optimize -quality 80 >$smalltarget`;
if ($side == 2) { $side=0; }
print INDEX <<"__EOF__";
 |
__EOF__
if ($count++ >= $per_row) {
print INDEX "
\n\n";
$count=1;
}
$side++;
}
print INDEX <<"__EOF__";
__EOF__
close(INDEX);