#!C:\Perl\bin\perl.exe
use strict 'vars';
use Env;
use CGI::Carp qw(fatalsToBrowser);
use Image::Magick;
print <
BLOCK
my($image, $x, $file);
$image = Image::Magick->new;
my $dirname = join('/', "$ENV{'DOCUMENT_ROOT'}", 'local/');
my $dirname2 = join('/', "$ENV{'DOCUMENT_ROOT'}", 'thumbs/');
opendir(DIR, $dirname);
while (defined($file = readdir(DIR))) {
next if $file =~ /^\.\.?$/;
print <$dirname$file
BLOCK
$x = $image->Read('$file');
warn "$x" if "$x";
$x = $image->Crop(geometry=>'90x90+100+100');
warn "$x" if "$x";
$x = $image->Write('$dirname2$file');
warn "$x" if "$x";
print <
BLOCK
}
closedir(DIR);
print <
BLOCK