#!/usr/bin/perl
# view a picture
print "Content-type: text/html\n\n";
if( $ENV{SCRIPT_NAME} =~ m/show/ ) { $show = TRUE };
if( $ENV{SCRIPT_NAME} =~ m/(\d\d\d\d)/ )
{
$year = $1; # Capture year on path to pictures
}
$image_number = $ENV{'QUERY_STRING'};
$image="at".$year."-".$image_number."v.jpg";
$rotated_image="at".$year."-".$image_number."r.jpg";
$text_file="discription.txt";
$title="Appalachian Trail - Summer ".$year;
$trail="Appalachian Trail";
if( -e $image )
{
print( "
");
if( $show ) { print("Show - "); }
print( " $image ");
if( -e "reverse" )
{
$prior = $image_number+1;
$next = $image_number-1;
}
else
{
$prior = $image_number-1;
$next = $image_number+1;
}
$prior = sprintf("%4.4d", $prior );
$next = sprintf("%4.4d", $next );
if( $show )
{
print(" ");
print( "\n" );
}
else
{
print( "\n" );
}
print " $trail $year
";
printf("Index Page \n", $image_number);
print("Prior \n");
print("Next \n");
# Correct for original image names depending on camera
if( $year < 2006 )
{
print("Original \n");
}
else
{
print("Original \n");
}
if( $show )
{
print("Stop");
}
else
{
print("Show");
}
if( -e $rotated_image )
{
print(" Rotated full size\n");
}
print(" 
 ");
print("
\n");
print("\n");
}
else
{
print("Image: $image not found.\n");
open( INDEX, " ) { print; }
}