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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…