Linked Questions

Popular Questions

How to get the file size of a remotely stored image? (php)

Asked by At

Let's say we have an image file, stored in a remote server (for example, let's take this image), how can we determine (in PHP code) it's file size?

If the file was on server, we would have used filesize (see here), but this wouldn't work on a remote file (see here).

The other alternative is to check for the "Content-Length", but I believe it wouldn't work for an image file (see here)

I would like for a solution like the one given here (e.g, something like:

<?php
function get_remote_size($url) {  // magic
}
echo get_remote_size("http://humus101.com/wp-content/uploads/2009/11/Hummus-soup.jpg");
?>

But without the need to download the image. Is that possible?

Related Questions