Created
August 8, 2012 07:56
-
-
Save cloudsben/3293287 to your computer and use it in GitHub Desktop.
Use PHP judge GIF image animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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