How to know if a GIF image is animated in PHP ?

function isImageAnimated($file)
{
    $nb_image_frame = 0;
    $image = new Imagick($file);
    foreach($image->deconstructImages() as $i) {
        $nb_image_frame++;
        if ($nb_image_frame > 1) {
            return true;
        }
    }
    return false;
}

Note that this function uses imagick php extension.

Discussion

Enter your comment
 
 
 

Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki