Subject: | gen_thumb cannot handle a filehandle |
In your Synopsis example code you use &gen_thumb; however this code does not work, as &gen_thumb (or more namely Image::Magick) cannot handle the filehandle that is passed to it by CGI::Uploader. I have worked around the issue, and included a diff that will show you what I did.
--- ImageMagick.pm 2005-04-02 13:32:16.000000000 -0500
+++ /home/steven/work/tp/CalendarKidz/perl5/CGI/Uploader/Transform/ImageMagick.pm 2005-08-03 16:26:04.000000000 -0400
@@ -4,6 +4,7 @@
use File::Temp qw/tempfile/;
use Params::Validate (qw/:all/);
use Carp::Assert;
+use Data::Dumper;
use vars (qw/@EXPORT $VERSION/);
$VERSION = 1.1_1;
@@ -49,6 +50,10 @@
h => { type => SCALAR | UNDEF, regex => qr/^\d*$/, optional => 1 },
});
die "must supply 'w' or 'h'" unless (defined $p{w} or defined $p{h});
+ die "File not found - $orig_filename" unless -e $orig_filename;
+ warn "Going to xform '$orig_filename'";
+ warn "Ref = " . ref($orig_filename);
+ warn "Dump = " . Dumper($orig_filename);
# Having both Graphics::Magick and Image::Magick loaded at the same time
# can cause very strange problems, so we take care to avoid that
@@ -60,6 +65,8 @@
}
elsif (exists $INC{'Image/Magick.pm'}) {
$magick_module = 'Image::Magick';
+ # Workaround for Image::Magick filehandle limitations.
+ $orig_filename = $self->{'updir_path'} . '/' . scalar($orig_filename) if ref($orig_filename);
}
# If neither are already loaded, try loading either one.