note 104473 added to function.imagecreatefromgif
| From: | frank at huddler dot com | Date: | Thu, 16 Jun 2011 19:25:29 +0000 |
| Subject: | note 104473 added to function.imagecreatefromgif | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180628@lists.php.net to get a copy of this message | ||
An updated is_ani based on issues reported here and elsewhere
<?php
function is_ani($filename) {
if(!($fh = @fopen($filename, 'rb')))
return false;
$count = 0;
//an animated gif contains multiple "frames", with each frame having a
//header made up of:
// * a static 4-byte sequence (\x00\x21\xF9\x04)
// * 4 variable bytes
// * a static 2-byte sequence (\x00\x2C) (some variants may use \x00\x21 ?)
// We read through the file til we reach the end of the file, or we've found
// at least 2 frame headers
while(!feof($fh) && $count < 2) {
$chunk = fread($fh, 1024 * 100); //read 100kb at a time
$count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00(\x2C|\x21)#s', $chunk,
$matches);
}
fclose($fh);
return $count > 1;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 208.66.27.58
----
Manual Page -- http://www.php.net/manual/en/function.imagecreatefromgif.php
Edit -- https://master.php.net/note/edit/104473
Del: integrated -- https://master.php.net/note/delete/104473/integrated
Del: useless -- https://master.php.net/note/delete/104473/useless
Del: bad code -- https://master.php.net/note/delete/104473/bad+code
Del: spam -- https://master.php.net/note/delete/104473/spam
Del: non-english -- https://master.php.net/note/delete/104473/non-english
Del: in docs -- https://master.php.net/note/delete/104473/in+docs
Del: other reasons-- https://master.php.net/note/delete/104473
Reject -- https://master.php.net/note/reject/104473
Search -- https://master.php.net/manage/user-notes.php