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!

In reply to Re: Re: Saving the first frame of any image by coldfingertips
in thread Saving the first frame of any image by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.