in reply to Re: Saving the first frame of any image
in thread Saving the first frame of any image

Thanks for your code! I tried making the changes needed but now I get an error rather than it just not working. This script uploads the image as a whole then it creates and uploads the thumbnail of it. I only want the first frame of the thumbnail uploaded, the rest can rott in the cyber morgue.

This entire script worked a few days ago, it uploaded the image and the thumbnails..but I tried to make it to only upload one thumbnail and I killed the script! lol.

Error:

rock6.jpg Software error: Can't call method "Flatten" on an undefined value at uploadv25.pl line + 232.
I did a test print on $filename and you can see it prints out successfully before the script dies. So how can it say it's undefined?
print $filename; $localfile = $filename; $localfile =~ m/(.*)\.(.*)/; $newfilename = "$thumbdir/$1.png"; my ($image, $x); $image=Image::Magick->new; $image->BlobToImage($localfile); $image = $image->[0]; $image->Flatten(); #$x = $image->Read($localfile); warn "$image" if "$image"; $x = $image->Resize(width=>100, height=>100); $x = $image->Write($newfilename); warn "$x" if "$x";
The following preceeds the rest of the code above, this is what I'm using to upload the entire image itself to the server before ImageMagick is used. Remember, this DOES work and files DO upload.
open( SAVED, ">>$localfile" ); # || die $!; while ( $bytesread = read( $remotefile, $buffer, 1024 ) ) { print SAVED $buffer; } close SAVED;
Thanks for your help!

Replies are listed 'Best First'.
Re: Re: Re: Saving the first frame of any image
by TilRMan (Friar) on Mar 26, 2004 at 02:29 UTC
    $image->BlobToImage($localfile) isn't right. As gt8073a put in his comments, "## you need to read in the data from the uploaded file." He used <> and you used ->Read() originally.

    -- 
    LP^>