note 20036 added to function.getimagesize
| From: | nospam dot jemore at nospam dot m6net dot fr | Date: | Wed, 20 Mar 2002 10:12:00 +0000 |
| Subject: | note 20036 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27983@lists.php.net to get a copy of this message | ||
A simple function to get the size of a gif image, without GD lib or without loading all the image :
function GetGifSize($filename, &$width, &$height)
{
DEFINE('GIFBUFSIZE', 10);
@set_magic_quotes_runtime(0);
$fd = fopen($filename, 'rb');
$a = fread($fd, GIFBUFSIZE);
fclose($fd);
@set_magic_quotes_runtime(get_magic_quotes_gpc());
if ((ord($a[0]) == 0x47) && (ord($a[1]) == 0x49) && (ord($a[2]) == 0x46)) //
'GIF'
{
$width = ord($a[7]) * 256 + ord($a[6]);
$height = ord($a[9]) * 256 + ord($a[8]);
return true;
}
else
return false;
}
--
http://www.php.net/manual/en/function.getimagesize.php
http://master.php.net/manage/user-notes.php?action=edit+20036
http://master.php.net/manage/user-notes.php?action=delete+20036
http://master.php.net/manage/user-notes.php?action=reject+20036