Jay Buffington <[EMAIL PROTECTED]> said something to this effect on 07/11/2001:
> I'm trying to use image magick to manipulate images that are
> uploaded via http. To handle the uploaded images I'm using
> libapreq's Apache::Upload.
>
> I wrote the below simple example script to help explain my problem.
>
> When an image is uploaded to it I get this error in the apache
> error log: ImageMagick error: Warning 320: no delegate for this
> image format (:Upload=GLOB(0x873bcec)) [No such file or
> directory]
>
> I'm confused why this happens. Could someone please explain
> this behaviour to me?
This looks like $r->upload->fh is being stringified, probably
because of the context. What happens when you assign the glob
returned by $r->upload->fh to a lexical scalar, and then pass
that into $image->Read()? I hit this a few days ago, when
passing a glob reference into a subroutine (not
mod_perl-related), and this is the only thing that worked.
>
> package UploadFile;
>
> use Apache;
> use Apache::Request;
> use Apache::Constants qw(:common);
> use CGI qw(-compile :standard);
> use Image::Magick;
>
> sub handler {
> my $r = new Apache::Request(shift);
>
> if ($r->param('action') eq "upload") {
> my $image = new Image::Magick;
Add these changes:
my $fh = $r->upload->fh;
my $error = $image->Read(file => $fh);
> $r->log_error("ImageMagick error: $error") if $error;
> $r->print("image geometry: " . join " x ",
> $image->Get('width', 'height'));
> undef $image;
> }
>
> $r->print(start_html() . start_multipart_form() . "Upload an image: " .
> filefield(-name=>"uploadedfile") . submit(-name=>"action",
> -value=>"upload") . end_form() . end_html());
>
> return OK;
> }
>
> 1;
(darren)
--
Death to all fanatics!