note 40653 deleted from function.getimagesize by nlopess

From: Date: Thu, 11 Mar 2004 14:59:45 +0000
Subject: note 40653 deleted from function.getimagesize by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66655@lists.php.net to get a copy of this message
Note Submitter: ---- An optimized edit of the function posted below by djwishbone at hotmail dot com. I was having trouble on some servers using getimagesize so I needed one that would work in more situations. This seemed to do the trick. <?php function getimagesize_remote($image_url) { $handle = fopen($image_url, "rb"); $contents = ""; if ($handle) { while ($data = fread($handle, 8192)) $contents .= $data; fclose ($handle); $im = imagecreatefromstring($contents); if ($im) { $gis[0] = imagesx($im); $gis[1] = imagesy($im); $gis[3] = "width=\"{$gis[0]}\" height=\"{$gis[1]}\""; imagedestroy($im); return $gis; } } return false; } ?>

« previous php.notes (#66655) next »