From 6f4d9f8a9d170830bd01b24da8ab73f1744e9d11 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 3 Jul 2011 14:47:39 +0200 Subject: add --filenamedesc; refactor how title attribute is generated Signed-off-by: Florian Pritz --- generate_gallery.pl | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/generate_gallery.pl b/generate_gallery.pl index a5f3c8b..6f68cd5 100755 --- a/generate_gallery.pl +++ b/generate_gallery.pl @@ -14,7 +14,7 @@ my $templatedir = abs_path(dirname($0))."/generate_gallery.d"; my $startdir = cwd(); my %opts = (); -GetOptions(\%opts, "exif|e", "verbose|v", "help|h") or pod2usage(2); +GetOptions(\%opts, "exif|e", "verbose|v", "help|h", "filenamedesc") or pod2usage(2); pod2usage(0) if $opts{help}; pod2usage(-verbose => 0) if (@ARGV== 0); @@ -35,6 +35,7 @@ for my $dir (@ARGV) { my $html; for my $file (glob("*")) { + my $description = ""; unless (mimetype($file) =~ /^image\/.*/) { print "ignoring non-image: $dir/$file\n" if $opts{verbose}; next; @@ -47,12 +48,21 @@ for my $dir (@ARGV) { $img->Thumbnail(geometry=>"200x200"); $img->Write("$abs_dir/thumbs/$file"); } - $html .= "
\n"; - $html .= "{ShutterSpeed}."s, ".$tags->{FocalLength}." @ F ".$tags->{Aperture}."\""; + $description .= $tags->{ShutterSpeed}."s, ".$tags->{FocalLength}." @ F ".$tags->{Aperture}; } + + $html .= "\n"; @@ -84,6 +94,7 @@ generate_gallery.pl [options] --help, -h short help message --verbose, -v be verbose during operation --exif, -e add exif information of each image to the page + --filenamedesc add the filename to the description =head1 OPTIONS @@ -99,11 +110,15 @@ Be verbose. =item B<--exif>, B<-e> -Add the following exif information to the page: +Add the following exif information to the image description: shutter speed, ISO, focal length, aperture This is only recomended for pictures taken with digital cameras. +=item B<--filenamedesc + +Add the filename to the image description. The extension will be stripped. + =back =head1 DESCRIPTION -- cgit v1.2.3-24-g4f1b