Okay I'm using Image::Magick to resize some images to thumbnails. I thought about using GD but I will probably be adding functions to this app later that GD can't do.
Anyway reading the original, resizing and writing the new image to a new file all works just fine but after I've done this I can no longer write to STDOUT and subsequently the webserver throws a 500 error because it doesn't receive any output from the program.
I tried selecting STDOUT ( select STDOUT) but it still didn't work. However when I did:
print STDOUT "Output blah blah ...";
It works but I feel its kind of ugly. Any ideas on being able to default back to STDOUT (am I doing something wrong?).
Here's the code in question for those interested.
my $image = Image::Magick->new; open(IMAGE,"$path") or upload_failed("Couldn't open $path for reading" +,$path); $image->Read(file=>*IMAGE); close(IMAGE); $image->Resize(width=>$conf->thumb_width,height=>$conf->th +umb_height); open(THUMB,">$thumbs/thumb_$filename") or upload_failed("Couldn't open + thumbnail file: $!",$path); $image->Write(file=>*THUMB,filenam +e=>"$thumbs/thumb_$filename"); close(THUMB); # no longer can write to STDOUT from this point on. works if # I delet +e the line $image->Write ....
Chris
Some clever or funny quote here.In reply to Weird problems with Image::Magick and STDOUT by cfreak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |