function ranger in Flickr 7
Alternative to the PHP function getimagesize. See https://stackoverflow.com/questions/4635936/super-fast-getimagesize-in-php.
1 call to ranger()
- theme_flickr_photo in ./
flickr.module - Theme Flickr photo.
File
- ./
flickr.module, line 1046 - The Flickr module.
Code
function ranger($url) {
$headers = array(
"Range: bytes=0-32768",
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
$im = @imagecreatefromstring($data);
if ($im) {
$width = imagesx($im);
return $width;
}
elseif (ini_get("allow_url_fopen")) {
list($width) = getimagesize($url);
return $width;
}
}