Topic: How to prevent animated GIFs as avatar?

I've search the forum and found this code which relates to 1.2

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

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

       }
       else
       {
               return(false);
       }
}

Is there a solution for 1.3?
I'm happy for GIFs to be used, but not animated ones.

Thanks for any help
Mark

Re: How to prevent animated GIFs as avatar?

Place the following code under Line 1062 on 'profile.php':

function is_ani($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);
    }
}

if(is_ani($uploaded_file['tmp_name']))
    $errors[] = 'You can\'t use animations.';

I guess that should work... I didn't change anything on the function, btw...

Re: How to prevent animated GIFs as avatar?

It worked!!
Thanks for telling where to put it Garciat smile