ImagickOperationTrait.php in Imagick 8
File
src/Plugin/ImageToolkit/Operation/imagick/ImagickOperationTrait.php
View source
<?php
namespace Drupal\imagick\Plugin\ImageToolkit\Operation\imagick;
use Imagick;
trait ImagickOperationTrait {
protected function execute(array $arguments) {
return $this
->processFrames($arguments);
}
protected function processFrames(array $arguments = []) {
$resource = $this
->getToolkit()
->getResource();
try {
$image_format = $resource
->getImageFormat();
} catch (ImagickException $e) {
}
$success = TRUE;
if (isset($image_format) && in_array($image_format, [
'GIF',
])) {
$resource = $resource
->coalesceImages();
do {
if (!$this
->process($resource, $arguments)) {
$success = FALSE;
break;
}
} while ($resource
->nextImage());
$resource
->deconstructImages();
}
else {
$success = $this
->process($resource, $arguments);
}
$this
->getToolkit()
->setResource($resource);
return $success;
}
}