mirror of
https://github.com/Intervention/image.git
synced 2025-02-06 22:00:38 +01:00
animations on images will be removed on init
This commit is contained in:
parent
2582007a17
commit
e6fb391319
@ -56,6 +56,10 @@ class Source extends \Intervention\Image\AbstractSource
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -85,4 +89,25 @@ class Source extends \Intervention\Image\AbstractSource
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user