Re[2]: [PHP] Getting the filesize of an image?
| From: | faeton | Date: | Sat, 01 Dec 2001 21:21:53 +0000 |
| Subject: | Re[2]: [PHP] Getting the filesize of an image? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76325@lists.php.net to get a copy of this message | ||
Hello Matt,
So does that problem have a solution?
MM> Not on binary files. For an image that's 4494 bytes, file/join/strlen gives
MM> me 3512. And since file() on a remote file is downloading it anyway, you
MM> might as well do it right:
MM> $fp =
MM> fopen('http://example.com/image.jpg','r');
MM> while (!feof($fp))
MM> $image .= fread($fp,1024);
MM> echo strlen($image);
MM> Matt
------------------------------------------------
Ivan 'Faeton aka xetrix' Danishevsky
ICQ(240266) faeton@xemichat.com www.xemichat.com