protected function SetGifTransparentColor::execute in Image Effects 8
Same name in this branch
- 8 src/Plugin/ImageToolkit/Operation/gd/SetGifTransparentColor.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\SetGifTransparentColor::execute()
- 8 src/Plugin/ImageToolkit/Operation/imagemagick/SetGifTransparentColor.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\SetGifTransparentColor::execute()
Same name and namespace in other branches
- 8.3 src/Plugin/ImageToolkit/Operation/imagemagick/SetGifTransparentColor.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\SetGifTransparentColor::execute()
- 8.2 src/Plugin/ImageToolkit/Operation/imagemagick/SetGifTransparentColor.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\SetGifTransparentColor::execute()
File
- src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ SetGifTransparentColor.php, line 27
Class
- SetGifTransparentColor
- Defines ImageMagick set_gif_transparent_color image operation.
Namespace
Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagickCode
protected function execute(array $arguments) {
$format = $this
->getToolkit()
->getDestinationFormat() ?: $this
->getToolkit()
->getSourceFormat();
$mime_type = $this
->getFormatMapper()
->getMimeTypeFromFormat($format);
if ($mime_type === 'image/gif' && $arguments['transparent_color']) {
$index = $this
->getToolkit()
->findArgument('-alpha off -transparent-color');
if ($index !== FALSE) {
$this
->getToolkit()
->removeArgument($index);
}
$this
->getToolkit()
->addArgument('-alpha off -transparent-color ' . $this
->getToolkit()
->escapeShellArg($arguments['transparent_color']) . ' -transparent ' . $this
->getToolkit()
->escapeShellArg($arguments['transparent_color']));
}
}