All pastes #544969 Raw Edit

negatendo

public php v1 · immutable
·published 2007-06-06 17:36 UTC
rendered paste body
<?phpdefine("GIF_FRAME_START", "\x00\x21\xF9\x04");define("GIF_FRAME_END", "\x00\x2C");function is_ani($filename){	$filecontents=file_get_contents($filename);	$str_loc=0;	$frames=0;	while ($frames < 2) # There is no point in continuing after we find a 2nd frame	{		$frame_start=strpos($filecontents, GIF_FRAME_START, $str_loc);		if ($frame_start === FALSE)		{			break;		}		else		{		  $str_loc=$frame_start+1;		  $frame_end=strpos($filecontents,GIF_FRAME_END,$str_loc);			if ($frame_end === FALSE)			{				break;			}			else			{			  // This needs an explanation				if ($frame_start+8 == $frame_end)				{					$frames++;				}			  $str_loc=$frame_end+1;			}		}	}	if ($frames > 1)	{		return(true);	}	else	{		return(false);	}}?>