<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

$title = '';
$thumb = "./thumb";                             # directory where thumbnails are stored
$catalog = "catalog.html";                      # catalog html page
$thumbquality =  70;                            # Thumbnail image quality, range 0 - 100
$thumbwidth = 260;                              # Thumbnail width
$thumbheight = 196;                              # Thumbnail height

$im_identify  = "/usr/bin/identify";      # Path to Imagemagick "identify" program
$im_convert   = "/usr/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|gif|GIF/) {push (@images,$file); }
        }


# output catalog html


open(CATALOG,"&gt;$catalog") || die "Can't open: $catalog\n";

print CATALOG "&lt;html&gt;\n";
print CATALOG "&lt;head&gt;\n";
print CATALOG "&lt;title&gt;$title&lt;/title&gt;\n";
print CATALOG "&lt;/head&gt;\n";
print CATALOG "&lt;body&gt;\n";
print CATALOG "&lt;/body&gt;\n";
print CATALOG "&lt;/html&gt;\n";
print CATALOG "&lt;h1&gt;$title&lt;/h1&gt;&lt;/td&gt;\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&lt;br&gt;\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 "&lt;a href=\"$image\"&gt;&lt;img src=\"$thumb/$image\" border=\"1\" alt=\"$title\"&gt;&lt;/a&gt;\n";
    }

print CATALOG "&lt;/body&gt;\n";
print CATALOG "&lt;/html&gt;\n";

close (CATALOG);

exit;
</pre></body></html>