Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/09/2007, 18:58
Avatar de Seppo
Seppo
 
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 20 años
Puntos: 17
Re: Diferenciar Tipo de imagenes

Yeah, encontré una en php.net (imagecreatefromgif), pero no la probé

El código
Código PHP:
<?php

function is_ani($filename)
{
        
$filecontents=file_get_contents($filename);

        
$str_loc=0;
        
$count=0;
        while (
$count 2# There is no point in continuing after we find a 2nd frame
        
{

                
$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+== $where2)
                                {
                                        
$count++;
                                }
                                
$str_loc=$where2+1;
                        }
                }
        }

        if (
$count 1)
        {
                return(
true);

        }
        else
        {
                return(
false);
        }
}

exec("ls *gif" ,$allfiles);
foreach (
$allfiles as $thisfile)
{
        if (
is_ani($thisfile))
        {
                echo 
"$thisfile is animated<BR>\n";
        }
        else
        {
                echo 
"$thisfile is NOT animated<BR>\n";
        }
}
?>