Pimcore\Model\Asset\Image::isAnimatedGif PHP Method

isAnimatedGif() private method

Checks if this object represents an animated gif file
private isAnimatedGif ( ) : boolean
return boolean
    private function isAnimatedGif()
    {
        $isAnimated = false;
        if ($this->getMimetype() == 'image/gif') {
            $fileContent = $this->getData();
            /**
             * An animated gif contains multiple "frames", with each frame having a header made up of:
             *  - a static 4-byte sequence (\x00\x21\xF9\x04)
             *  - 4 variable bytes
             *  - a static 2-byte sequence (\x00\x2C) (some variants may use \x00\x21 ?)
             *
             * @see http://it.php.net/manual/en/function.imagecreatefromgif.php#104473
             */
            $numberOfFrames = preg_match_all('#\\x00\\x21\\xF9\\x04.{4}\\x00(\\x2C|\\x21)#s', $fileContent, $matches);
            $isAnimated = $numberOfFrames > 1;
        }
        return $isAnimated;
    }