mirror of
https://github.com/Intervention/image.git
synced 2025-08-24 06:22:57 +02:00
animations on images will be removed on init
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user