#!/usr/local/bin/perl # CHANGE LINE ABOVE IF NECESSARY TO LOCATION OF YOUR PERL INTERPRETER. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # WebImageLister 1.0 # -------------------- # A no-frills VERY simple but VERY effective, easy-to-install Perl # script to display .GIF, .JPG, .JPEG, .PNG and .BMP images in a table # as clickable thumbnails from a single web directory. # # Defaults: Thumbnails -- 80 pixels wide. Table width -- 7 columns. # # IMPORTANT: Lines in ALL CAPS indicate where changes can or *must* be made # to customize script for your system and/or preferences. # # Script must be run from a cgi-bin directory on the web server. # # Source of script: http://www.10xshooters.com/webimagelister # # Adapted by Henry Baker from a generic script found somewhere on the Web. # Website: http://www.10xshooters.com/webimagelister # Email: hbaker@ipa.net # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $pos=0; $upname=""; $count=0; # YOU *MUST* CHANGE THIS URL *BETWEEN* THE QUOTE MARKS TO YOUR IMAGE DIRECTORY. # BE SURE TO INCLUDE THE TRAILING SLASH. $imgpath="http://www.stevepereira.com/photo/football/batch3/"; # UNIX SYSTEM PATH (DEFAULT) # ---------------------------- # YOU *MUST* CHANGE THE PATH BELOW *BETWEEN* THE QUOTE MARKS (the ALL CAPS STUFF) # TO POINT TO YOUR IMAGE DIRECTORY. opendir(curdir,"../../../public_html/photo/football/batch3/")||die("Cannot open Directory!"); # NT SYSTEM PATH (CHANGE FOR AN NT SERVER) # ------------------------------------------ # FOR AN NT SYSTEM CHANGE THIS PATH *BETWEEN* THE QUOTE MARKS TO POINT TO # YOUR IMAGE DIRECTORY. REMOVE THE COMMENT POUND SIGN (#) BEFORE IT AND # PLACE A COMMENT POUND SIGN BEFORE THE UNIX SYSTEM PATH ABOVE. # opendir(CURDIR,"E:\\www\\images\\clipart\\")||die("Cannot open Directory!"); @names=sort(readdir(curdir)); print "content-type: text/html", "\n\n"; # CHANGE TEXT BETWEEN TITLE TAGS TO REFLECT YOUR HTML PAGE TITLE: print "
$name | \n";
$count=$count+1;
}
$pos=index($upname,".JPG");
if ($pos > 0)
{
print "$name | \n";
$count=$count+1;
}
$pos=index($upname,".JPEG");
if ($pos > 0)
{
print "$name | \n";
$count=$count+1;
}
$pos=index($upname,".PNG");
if ($pos > 0)
{
print "$name | \n";
$count=$count+1;
}
$pos=index($upname,".BMP");
if ($pos > 0)
{
print "$name | \n";
$count=$count+1;
}
# CHANGE THE NUMBER IN THE NEXT LINE TO HOW MANY COLUMNS YOU WANT IN IMAGE TABLE:
if ($count==3)
{
print "