#!/usr/bin/perl # draft html output $text_file="discription.txt"; $title="Appalachian Trail - Summer 2013"; $trail="Appalachian Trail"; $convert = 0; if( (@ARGV + 0) > 1 ) { $title= $title." - ".$ARGV[1]; } if( -e $text_file ) { if ( open( NOTES, "$text_file" ) < 1 ) { print( "Failed to open NOTES: $text_file, run list.pl first" ); } while( ) { chomp; ($picture, $date_time, $rotate, $info, $tags, $text) = split( /;/, $_, 6); # Max six fields $first_char = substr( $picture, 0, 1); if( $first_char eq "T" ) # Title { $title_found = TRUE; $title = $date_time; print("\n\n". "$title\n". "\n\n". "

$title

\n". "
Unless otherwise indicated all pictures are licensed under the Creative \n". "Commons Attribution 3.0 Unported License.
\n". "\"Creative
This work is licensed \n". "under a Creative \n". "Commons Attribution 3.0 Unported License.
\n". "All usage needs to include the following attribution: \"Picture taken by Louis Taber\".
\n". "All pictures with people are ©2013 by Louis Taber with all rights reserved.\n". "

"); print("Home   $trail - 2013 index
\n"); next; } if( $first_char eq "c" ) # Comment -- nor horz. rule or break. { if( $title_found != TRUE ) { print("No title, please fix\n"); exit(2);} printf( "\n%s\n", $date_time); next; } #comment if( $first_char eq "C" ) # Comment { if( $title_found != TRUE ) { print("No title, please fix\n"); exit(2);} printf( "\n%s
\n", $date_time); next; } $_=$picture; if( /IMG_(....)\.JPG/ ) { if( $title_found != TRUE ) { print("Picture with no title, please fix\n"); exit(3); } $file_root = $1; } else { print("Picture named *$picture* not found in $text_file.\n") } if( $rotate eq 1 ) {$angle = 0;} elsif( $rotate eq 6 ) {$angle = 90;} elsif( $rotate eq 8 ) {$angle = -90;} elsif( $rotate >= -180 && $rotate <= 180 ) { $angle = $rotate; print(" Custom rotate: Rotate: $rotate Angle: $angle \n"); } else {print(" Rotate Error: Rotate: $rotate Angle: $angle \n"); next;} $mfile= "at2013-".$file_root."m.jpg"; # medium size -- for netbook $vfile= "at2013-".$file_root."v.jpg"; # Size to View if( $debug ) { print( "File root: ", $file_root, " File:",$picture, "\n "); print( "Date: ", $date_time, "Rotate:", $rotate, "\n"); print( "Info & text", $info, " Picture text:", $text, "\n\n"); print( "Angle: $angle Target file: $mfile\n"); } if( ! -e $mfile ) # Max size 300x300 { if( $debug ) { print "convert -geometry 300x300 -quality 95 -rotate $angle $picture $mfile"; } `convert -geometry 300x300 -quality 95 -rotate $angle $picture $mfile`; $convert++; } printf( " ", $file_root); printf( " \"%s\"
\n", $file_root, $mfile, $tags ); printf( " %s   Original     \n", $picture, $picture ); printf( " %s
\n", $info ); if( abs($angle) < .05 ) { if( ! -e $vfile ) # Max size 1000x750 { if( $debug ) { print "convert -geometry 1000x750 -quality 95 -rotate $angle $picture $vfile"; } `convert -geometry 750x1000 -quality 95 -rotate $angle $picture $vfile`; $convert++; } } else { $rotate_file= "at2013-".$file_root."r.jpg"; # full size rotated image if( ! -e $rotate_file ) { `convert -quality 95 -rotate $angle $picture $rotate_file`; $convert++; } if( ! -e $vfile ) # Max size 1000x750 { if( $debug ) { print "convert -geometry 800x600 -quality 95 $rotate_file $vfile"; } `convert -geometry 800x600 -quality 95 $rotate_file $vfile`; $convert++; } printf( " Full size rotated image    \n", $rotate_file ); printf( " Rotation angle: %i     \n ", $angle ); } printf( " %s   \n ", $date_time ); printf( " Tags: %s
\n", $tags); if($tags =~ m/,/ ) { print( "

Comma not supported yet

<\font>
"); } if( $tags =~ m/B/ ) { print("Bridge on the $trail.
\n"); } if( $tags =~ m/C/ ) { print("Creek on $trail.
\n"); } if( $tags =~ m/F/ ) { print("Ford crossing on the $trail.
\n"); } if( $tags =~ m/G/ ) { print("Bog crossing on $trail.
\n"); } if( $tags =~ m/H/ ) { print("Highway or paved road crossing the $trail.
\n"); } if( $tags =~ m/L/ ) { print("Lake seen from $trail.
\n"); } if( $tags =~ m/O/ ) { print("Dirt, gravel, or logging road crossing the $trail.
\n"); } if( $tags =~ m/R/ ) { print("$trail crosses river, brook, or creek.
\n"); } if( $tags =~ m/S/ ) { print("$trail Sign.
\n"); } if( $tags =~ m/T/ ) { print("$trail.
\n"); } if( $tags =~ m/V/ ) { print("View from $trail
\n"); } if( $tags =~ m/X/ ) { print("©2013 Louis Taber, All rights reserved.
\n"); } if( $tags =~ m/Z/ ) { print("$trail with white blaze.
\n"); } printf( " Description: %s
\n\n", $text); } if($convert > .5 ) { print"
Convert: $convert\n";} print("\n"); }