#!/usr/bin/perl
$title = 'Sophies Wedding';
$thumb = "./thumb"; # directory where thumbnails are stored
$catalog = "catalog.html"; # catalog html page
$thumbquality = 70; # Thumbnail image quality, range 0 - 100
#$thumbwidth = 130; # Thumbnail width
#$thumbheight = 98; # Thumbnail height
$thumbwidth = 364; # Thumbnail width
$thumbheight = 273; # Thumbnail height
$im_identify = "/usr/local/bin/identify"; # Path to Imagemagick "identify" program
$im_convert = "/usr/local/bin/convert"; # Path to Imagemagick "convert"
# get list of files
@files = `ls ./ -1`; # get list of images
$n=0;
foreach $file (@files) {
chomp($file);
if ($file =~ /jpg|JPG/) {push (@images,$file); }
if ($file =~ /mp3|MP3/) {push (@sounds,$file); }
}
# output catalog html
open(CATALOG,">$catalog") || die "Can't open: $catalog\n";
print CATALOG "\n";
print CATALOG "
\n";
print CATALOG "$title\n";
print CATALOG "\n";
print CATALOG "\n";
print CATALOG "\n";
print CATALOG "\n";
print CATALOG "$title
\n";
print CATALOG "Image catalog.
\n";
# verify thumbnail directory exists
if (!(-d $thumb)) {mkdir $thumb, 0777; }
# create missing thumb nails
foreach $image (@images) {
if (!(-f "$thumb/$image")) {
print "making $thumb/$image
\n";
$arguments = "-geometry $thumbwidth" ."x"."$thumbheight -quality $thumbquality $image $thumb/$image";
$results=`$im_convert $arguments`;
}
}
foreach $image (@images) {
chomp ($image);
($title,$extension) = split(/\./, $image);
$title=~ s/\_|-/ /g;
$results=`$im_identify $image`;
($junk,$format,$dimensions,$junk,$depth,$size,$junk)=split(/\ /,$results);
($dimensions,$junk)=split(/\+/,$dimensions);
$title = $title . ' (' . $dimensions . ' ' . $size . ')';
print CATALOG "
\u$title.\n";
# print CATALOG "
\n";
}
print CATALOG "
\n";
foreach $sound (@sounds) {
chomp ($sound);
($title,$extension) = split(/\./, $sound);
$title=~ s/\_|-/ /g;
print CATALOG "sound \u$title.\n";
}
print CATALOG "