#!/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 ""; while (@sortpiclist) { my @row_entries= splice (@sortpiclist, 0, 4); print ""; for (@row_entries) { print ""; } print ""; } print ( end_html() );
"; $dir =~ s/\/www\/htdocs//; print qq|
$_

|; print "