in reply to Re: determining image size by a URL
in thread determining image size by a URL

Thanks for that, I passed a third arguement $error and now ALL the errors are the same Data stream is not a known image file format but I don't see how that is. All the images are JPG files with full URLs.

For example http://images.imagefap.com/images/full/9/144/1448694657.jpg returns with that error (it's a clean picture). What could cause this error then? Could the server possibly loaded too slow and it timed out?

Replies are listed 'Best First'.
Re^3: determining image size by a URL
by jhourcle (Prior) on Jul 07, 2006 at 19:08 UTC

    Print the stream out to a file, and look at it -- it may be that what you see in a web browser is different from what the program sees, due to browser sniffing techniques, content negotiation, etc.

    Just because you get an image in your web browser doesn't mean that your program's going to get an image. (they don't look to have a robots.txt, but it's possible they have some other way of slowing down requests hitting their server too quickly)

Re^3: determining image size by a URL
by shmem (Chancellor) on Jul 07, 2006 at 18:18 UTC
    Could be due to a bug in Image::Size or in your code. Is imgsize() always returning three values? If not, only $width and $height are set by the assignment, and $error remains unchanged if there was no error. Try setting $error explicitely to '' before calling imgsize().