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? 


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;
        my $error = $image->Read(file=>$r->upload()->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;

Reply via email to