in reply to Re^2: Unexpected Image::Info failure
in thread Unexpected Image::Info failure
So your cgi script does nothing but pass that url to the browser, it does not get the file.<HTML> <BODY> <IMG SRC="http://www.zentara.net/anim_a_s_r.gif" HEIGHT=65 WIDTH=75 a +lt="[zentara]" align=left> </BODY> </HTML>
The gobbldeeGook which you get when you use lwp to retreive the file, is the actual binary data of the image. You need to save it to a scalar( or a temp file) then run your image info routine on it.
#!/usr/bin/perl use warnings; use strict; use LWP::Simple; use Image::Info qw(image_info dim); my $data = get("http://www.learntogoogle.com/images/addform.jpg"); # this will print binary junk #print "$data\n"; my $info = image_info( \$data ); if (my $error = $info->{error}) { die "Can't parse image info: $error\n"; } my($w, $h) = dim($info); print "$w $h\n";
|
|---|