Skip to content

Instantly share code, notes, and snippets.

@cloudsben
Created August 8, 2012 07:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudsben/3293287 to your computer and use it in GitHub Desktop.
Save cloudsben/3293287 to your computer and use it in GitHub Desktop.
Use PHP judge GIF image animation
function check_gif($path)
{
// Reads entire file into a string
$content = file_get_contents($path);
// Find GIF89a in a string
$bool = strpos($content, 'GIF89a');
if($bool === FALSE)
{
// Find NETSCAPE2.0 in a string
return strpos($content, chr(0x21).chr(0xff).chr(0x0b).'NETSCAPE2.0')===FALSE?0:1;
}
else
{
return 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment