protected function ImagickOperationTrait::processFrames in Imagick 8
Process image frames for GIFs
Parameters
array $arguments:
Return value
bool
2 calls to ImagickOperationTrait::processFrames()
- ImagickOperationTrait::execute in src/
Plugin/ ImageToolkit/ Operation/ imagick/ ImagickOperationTrait.php - Resize::execute in src/
Plugin/ ImageToolkit/ Operation/ imagick/ Resize.php - Performs the actual manipulation on the image.
File
- src/
Plugin/ ImageToolkit/ Operation/ imagick/ ImagickOperationTrait.php, line 25
Class
- ImagickOperationTrait
- Class ImagickOperationTrait
Namespace
Drupal\imagick\Plugin\ImageToolkit\Operation\imagickCode
protected function processFrames(array $arguments = []) {
/* @var $resource Imagick */
$resource = $this
->getToolkit()
->getResource();
// If preferred format is set, use it as prefix for writeImage
// If not this will throw a ImagickException exception
try {
$image_format = $resource
->getImageFormat();
} catch (ImagickException $e) {
}
$success = TRUE;
if (isset($image_format) && in_array($image_format, [
'GIF',
])) {
// Get each frame in the GIF
$resource = $resource
->coalesceImages();
do {
if (!$this
->process($resource, $arguments)) {
$success = FALSE;
break;
}
} while ($resource
->nextImage());
$resource
->deconstructImages();
}
else {
$success = $this
->process($resource, $arguments);
}
// Set the processed resource
$this
->getToolkit()
->setResource($resource);
return $success;
}