#!/usr/bin/perl use warnings; use strict; use Image::Magick; #watch the width of your picture names #they can widen the table cells if too long umask 0022; my $image = Image::Magick->new; my $count = 0; open(OUT,">thumbs.html"); print OUT< End_Header my @pics= <*.jpg>; foreach my $pic (@pics){ $count++; my ($picbasename) = $pic =~ /^(.*).jpg$/; my $ok; $ok = $image->Read($pic) and warn ($ok); my ($w,$h)= $image->Get('columns','height'); my $thumb = $picbasename . '-t.jpg'; $ok = $image->Scale(geometry => '100x100')and warn ($ok); $ok = $image->Write($thumb)and warn ($ok); my ($tw,$th)= $image->Get('columns','height'); my $picoptions= $w.'x'.$h.'x'.$tw.'x'.$th; print "$pic\t$picoptions\n"; undef @$image; print OUT qq(); if($count == 4){print OUT ""; $count = 0}; } print OUT<
[$pic-thumbnail]
$pic
EOHTML close OUT;