#! /usr/bin/perl #redirect stderr to stdout so we can see err msgs on the web select(STDOUT); $|=1; #force flush of buffers after each print open (STDERR, ">&STDOUT") || die "can't dup stdout ($!)\n"; $myself = $0; $myself =~ s|.*/(.*)$|$1|g; $folder="."; $webhome=".."; $thumb="thumb/\_"; $hide='index|txt$|tag$|thumb|^\.|cgi$'; $title="Images at pinch.com"; $body= 'BGCOLOR="#333366" TEXT="#FFCC66" LINK="#99CCFF" VLINK="#99CC66" ALINK="#FF6600"'; $site='Images at Pinch.com'; if (-e ".showinfo") { require ".showinfo"; # allows customization per directory } $credit='Displayed using show.cgi script by Ed Anderson'; $query = $ENV{QUERY_STRING}; if (!$query) { $query = $ENV{PATH_INFO}; $query =~ s/^\///; # PATH_INFO will have a leading slash } if ($query) { print < $title - $query
$site
PREMESSAGE if (($query =~ m/jpg$/i) && (-e "$webhome/$folder/$query")) { $comment=""; $height=""; $width=""; if (open (COMMENT, "/usr/bin/rdjpgcom -verbose $webhome/$folder/$query |")) { while () { $comment .= "
$_"; if (m%image is (.*)w \* (.*)h%i) { $width="width=$1"; $height="height=$2"; } } close (COMMENT); } $info = $query; $info =~ s/(.*)\.jpg/$1\.txt/i; if ((-e "$info") && open(MESS,"$info")) { print "
\n"; while () { print "$_\n"; } close(MESS); print "
\n"; } print "

\n"; print "
$query\n
$comment

\n"; } else { warn ("$myself can't find $folder/$query $!\n"); } print "$credit
\n"; print "
$site
\n"; print "
\n\n"; exit; } ################## # end of specific query section @DT = localtime(time); $day= $DT[4]+1; print < $title

$title

END_OF_Start if (open(INCF,".include")) { while () { print $_; } close (INCF); } print <
Specimens on display (updated $DT[2]:$DT[1]:$DT[0] PST $day/$DT[3]/$DT[5] )

END_OF_Middle chdir $folder; opendir (DIR, "."); @files=readdir DIR; # foreach $item (sort { -M $a <=> -M $b } @files) { # by modification time foreach $item (sort @files) { # by name next if ($item =~ m/$hide/i); next if (-d $item); print "\n"; # print '\n"; # ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) # = stat($filename); print '"; if ($item =~ /jpg$/i) { print "\n"; } else { print "\n"; } open (LSOUT, "ls -ld $item |"); ($perms, $xx, $owner, $group, $bytes, $month, $day, $hour, $filename) = split(' ',); close (LSOUT); print "\n" ; print "\n"; } # while (($key,$value)= each %ENV) { print "\n"; } print "
'; # print "'; if ($item =~ m/\.html$/) { # show html titles if (open(MESS,"$item")) { while () { if (m%(.*)%i) { $title = $1; print ""; print EscapeHtml($1),"\n"; } } close(MESS); } else { print "can't open $open\n"; } } elsif (($item =~ /jpg$/i) && (-e "$thumb$item")) { print ") { if (m%image is (.*)w \* (.*)h%i) { print " width=$1 height=$2"; } } close (THUMB); } $comment=""; $info = $item; $info =~ s/(.*)\.jpg$/$1\.tag/i; if ((-e "$info") && open(MESS,"$info")) { while () { $comment .= "$_"; } close(MESS); print " alt=\"$comment\""; } print ">\n"; } else { print "
\n"; } print "
$item$item$hour $month $day$bytes bytes
$key$value
\n"; print "
$site
\n"; print "
$credit\n"; print "\n\n"; sub EscapeHtml { local($line)=$_[0]; $line=~s/&/\&/g; $line=~s//\>/g; $line=~s/"/\"/g; return $line; }