#!/usr/bin/perl -wT
# photo_display.pl
# script to select a category and display images within that directory
# sends data to photo_display2.pl
use CGI qw( :standard );
$startdir="/www/htdocs/photos"; # all images are in subdirectories of this directory
push(@dirs,$startdir);
foreach $dir (@dirs)
{
opendir(DIR,"$dir") || die ( "Error opening : $!" );
@list = grep { !/^\.\.?$/ } readdir(DIR);
closedir(DIR);
foreach $item (@list)
{
$fullname = $dir."/".$item; # add the directory name to the file name
if (-d $fullname)
{
push(@dirs,$fullname);
# print "$item
";
}
}
}
print( header() );
print( start_html( -title => "Image Gallery",
-dtd => '-//W3C//DTD HTML 4.01 Transitional//EN',
-meta=>{'description'=>'Image Gallery',
-created=>'20020926'},
-style =>{'src'=>'http:/photos/css/photos.css'},
-background =>'http:/images/flatwhit.gif' ) );
print '
##
#!/usr/bin/perl -wT
# photo_display2.pl
# display images within a directory
# receives directory information from photo_display.pl
use CGI qw( :standard );
print( header() );
print( start_html( -title => "USGS Photos",
-dtd => '-//W3C//DTD HTML 4.01 Transitional//EN',
-meta=>{'description'=>'Photo Gallery',
-created=>'20020926'},
-style =>{'src'=>'http:/photos/css/photos.css'},
-background =>'http:/images/flatwhit.gif' ) );
print 'Image Gallery
';
print '
';
print 'Click on an image to view a larger version.
';
my $dir = param( "pic" );
opendir(DIR,$dir) || die ("Error opening : $!" );
#directory contains text files that should not be used
@piclist = grep { !/^\.\.?$/ and /\.jpg$|\.gif$|\.png$|\.JPG$|\.bmp$/ } readdir(DIR);
@sortpiclist = sort @piclist; #images will display in alphanumeric ordeR
closedir(DIR);
print "