Есть ли способы определения я вляется ли gif файл статичным или анимированым?
27 Сен 2011, 12:38 function is_gif_animated($filename) {
$filecontents = file_get_contents($filename);
$str_loc = 0;
$count = 0;
while($count < 2) {
$where1 = strpos($filecontents, "\x00\x21\xF9\x04", $str_loc);
if($where1 === false) {
break;
} else {
$str_loc = $where1+1;
$where2 = strpos($filecontents, "\x00\x2C", $str_loc);
if($where2 === false) {
break;
} else {
if($where1+8 == $where2) {
$count++;
}
$str_loc = $where2+1;
}
}
}
if($count > 1) {
return true;
} else {
return false;
}
}