return $previouslyDetectedType;
} private function addAnimatedFlag(MediaFile
$mediaFile, MediaType
$rootType): void
{ $fileExtension =
mb_strtolower($mediaFile->
getFileExtension());
if ($fileExtension === 'gif' &&
$this->
isGifAnimated($mediaFile->
getFileName())) { $rootType->
addFlag(ImageType::ANIMATED
);
} if ($fileExtension === 'webp' &&
$this->
isWebpAnimated($mediaFile->
getFileName())) { $rootType->
addFlag(ImageType::ANIMATED
);
} } /**
* 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)
*
* We read through the file till we reach the end of the file, or we've found
* at least 2 frame headers
*/