-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Today at 10:14, 'John Michael' wrote: |JM|Perlmagick claims that it handles all of the file handling. And it really does it. So why don't you let him do its job!!?! ... meaning, why do you use things like: |JM| my $image = Image::Magick->new(magick=>'JPEG'); |JM| my $file = join("/",$working_dir, $pic); |JM| open(DATA, "$file") || die "$file $!"; |JM| $image->Read(file=>DATA); |JM| close(DATA); and |JM|open(DATA, ">$out_file"); |JM| $image->Write(file=>DATA,filename=>$out_file); |JM|close(DATA); instead of i.e.: my $image = Image::Magick->new; my $ret = $image->Read($file); return $ret if $ret; and $ret = $image->Write($out_file); return $ret if $ret; ?! Yet, there is no obvious error in your code that should drive you system crazy. So, there are some suggestions (in addition to the questioned one above :) that could make your code behave nicer: - - do check error codes returned by PerlMagick! - - globing? use it just at home ;-] in fact enhance your program using some MIME module to detect properly the file type + check out for files like 'foo.jpg' that in fact is an animated GIF file so you will get an entire group of output files instead of one etc... - - you will surely gain lots of cpu time if avoiding that rotation stuff*** - - use File::Spec for constructing file paths in a portable way - - you may wanna use some thumbmakeronly module :)) : Image::GD::Thumbnail if that gaussian blur it's not so important ;-] *** as I see it you need some thumbnails size normalization so: how to avoid image rotation and re-rotation? example: my ($w,$h) = calcGeometry($image->Get('width','height'), 50, 50); $ret = $image->Scale( width => $w, height => $h); warn $ret if $ret; sub calcGeometry { my ($w,$h,$stdW,$stdH) = @_; if($w>$h) { $h = $h/($w/$stdW); $w = $stdW; } else { $w = $w/($h/$stdH); $h = $stdH; } return int($w), int($h); } - -- Marius Feraru http://altblue.n0i.net/ "its easy to stop using Perl: I do it after every project" -----BEGIN PGP SIGNATURE----- iD8DBQE8DAVdn0ZKufYp8iURAkCWAJ918+VPfGN6ciLx+FnZeZATds4TcwCeI2bx tzjzTSoz4J/DSiez3rl5xSc= =KfuI -----END PGP SIGNATURE-----