1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-24 14:32:52 +02:00

animations on images will be removed on init

This commit is contained in:
Oliver Vogel
2014-05-25 21:00:00 +02:00
parent 2582007a17
commit e6fb391319

View File

@@ -56,6 +56,10 @@ class Source extends \Intervention\Image\AbstractSource
*/ */
public function initFromImagick(\Imagick $object) public function initFromImagick(\Imagick $object)
{ {
// currently animations are not supported
// so all images are turned into static
$object = $this->removeAnimation($object);
return new Image(new Driver, $object); return new Image(new Driver, $object);
} }
@@ -85,4 +89,25 @@ class Source extends \Intervention\Image\AbstractSource
return $image; return $image;
} }
/**
* Turns object into one frame Imagick object
* by removing all frames except first
*
* @param Imagick $object
* @return Imagick
*/
private function removeAnimation(\Imagick $object)
{
$imagick = new \Imagick;
foreach ($object as $frame) {
$imagick->addImage($frame->getImage());
break;
}
$object->destroy();
return $imagick;
}
} }