#!/usr/bin/perl use File::Basename; $cgi = basename $0; print "Content-Type: text/html\n\n"; $image = $ARGV[0]; $image =~ /img(\d+)/; print "Rockbox - Photo $1\n"; print "\n"; if ($image eq "" ) { print "

No image specified\n"; exit; } print "

 

\n"; # compressed image if ( $image =~ /img(\d+).jpg/ ) { $num = $1; for $i ( 1 .. 10 ) { $prev = sprintf("%04d",$num-$i); last if ( -f "img$prev.jpg" ); } if ( $prev == $num-10 ) { undef $prev; } for $i ( 1 .. 20 ) { $next = sprintf("%04d",$num+$i); print "\n"; last if ( -f "img$next.jpg" ); } if ( $next == $num+20 ) { undef $next; } if ( -f "bildtext.txt" ) { open FILE, "; close FILE; @match = grep /^$num: /, @txt; if ( $match[0] =~ /^$num: (.*)/ ) { print "

$1\n"; } } print "

\n"; print "< Previous   \n" if ( $prev ); print "Index\n"; if ( -f "IMG_$num.JPG" ) { $size = int( (stat("IMG_$num.JPG"))[7] / 1024 ); print "   Fullsize ($size kB)\n"; } print "   Next >\n" if ( $next ); } # showing fullsize already elsif ( $image =~ /IMG_(\d+).JPG/ ) { $num = $1; for $i ( 1 .. 10 ) { $prev = sprintf("%04d",$num-$i); last if ( -f "IMG_$prev.JPG" ); } if ( $prev == $num-10 ) { undef $prev; } for $i ( 1 .. 20 ) { $next = sprintf("%04d",$num+$i); print "\n"; last if ( -f "IMG_$next.JPG" ); } if ( $next == $num+20 ) { undef $next; } print "

\n"; print "< Previous   \n" if ( $prev ); print "Index\n"; if ( -f "img$num.jpg" ) { $size = int( (stat("img$num.jpg"))[7] / 1024 ); print "   Small ($size kB)\n"; } print "   Next >\n" if ( $next ); } print "

\n";