sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
It fails saying "Can't parse image info: Can't open http://www.learntogoogle.com/images/addform.jpg: No such file or directory". For those who want to see for sure, the image loads perfectly in the browser with this path.
I can't get Image::Info to open the image and I can't figure out why.
What could cause this to report about not being able to find the image when it can? Would it die like this if it didn't have permission to use the image off my server?#!/usr/bin/perl use warnings; use strict; use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; print header, start_html; my $img_src = "http://www.learntogoogle.com/images/addform.jpg"; use Image::Info qw(image_info dim); my $info = image_info($img_src); if ( my $error = $info->{error} ) { die "Can't parse image info: $error\n"; } my ( $width, $height ) = dim($info);
UPDATE I put some more tests in (as seen below). The image prints on page successfully but the -e test fails. Now I'm assuming it has to be some server issue.
#!/usr/bin/perl use warnings; use strict; use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; print header, start_html; my $img_src = "http://www.learntogoogle.com/images/addform.jpg"; print qq(<img src="$img_src">); use Image::Info qw(image_info dim); my $info = image_info($img_src); if (-e $img_src) { print "Image was found."; } else { print "Image is not available"; } if ( my $error = $info->{error} ) { die "Can't parse image info: $error\n"; } my ( $width, $height ) = dim($info);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unexpected Image::Info failure
by zentara (Cardinal) on Feb 25, 2006 at 16:41 UTC | |
by shotgunefx (Parson) on Feb 25, 2006 at 18:02 UTC | |
by sulfericacid (Deacon) on Feb 25, 2006 at 16:44 UTC | |
by Fletch (Bishop) on Feb 25, 2006 at 17:06 UTC | |
by zentara (Cardinal) on Feb 25, 2006 at 19:58 UTC | |
|
Re: Unexpected Image::Info failure
by shotgunefx (Parson) on Feb 25, 2006 at 15:56 UTC |