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);
In reply to Unexpected Image::Info failure by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |