On Wed, 20 Mar 2002 12:18:28 -0800, [EMAIL PROTECTED] (Agustin Rivera) wrote:
>I have a problem. The code below creates the error below. I can't see what >is wrong with it. I could of swore this code used to work. >Any ideas? > >use GD; >use LWP::Simple; >use strict; >### GET IMAGE ATTRIBS ><.. bunch of code that gets an image off the web and writes it to disk >successfully ..> > >open(OUT, ">image.jpg") or die $!; >binmode(OUT); >print OUT $content; >close(OUT); >my $image=GD::Image->newFromJpeg("image.jpg"); >my ($width,$height)=$image->getBounds(); > >Error: >Can't call method "getBounds" on an undefined value at ./sendanf.pl line 32. Well the code below runs fine. It seems you are wiping out the jpg with the print OUT statement. When GD gets it, it's no longer a jpg. ############################################### #!/usr/bin/perl use warnings; use GD; use LWP::Simple; use strict; #open(OUT, ">image.jpg") or die $!; #binmode(OUT); #print OUT my $content; #close(OUT); my $image=GD::Image->newFromJpeg("image.jpg"); my ($width,$height)=$image->getBounds(); print "$width\t$height\n"; ###############################################33 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]