views:

421

answers:

2

Does getimagesize use an extra HTTP request or can it find out the size remotely?

NOTE: The image is external

+3  A: 

It can fetch it remotely or locally:

This parameter [filename] specifies the file you wish to retrieve information about. It can reference a local file or (configuration permitting) a remote file using one of the supported streams.

From the manual.

James Skidmore
But would it be like using file_get_contents with the image?
Ben Shelock
@Ben, check out my answer; it's answering your question, not just throwing the manual back at you.
jvenema
+2  A: 

There will always be at least one HTTP request; otherwise how will it know what you're looking for?

If you're asking whether or not it'll download the file - yes, it will. There's no HTTP header that specifies image dimensions, so it doesn't know until the file is downloaded.

jvenema
There is no HTTP request if `getimagesize()` is used on a local file.
ceejayoz
Seriously? His question explicitly states "remotely". He's not looking for a local file request here.
jvenema
Thanks, that's what I was looking for.
Ben Shelock