Opacity.php in Imagick 8
File
src/Plugin/ImageToolkit/Operation/imagick/Opacity.php
View source
<?php
namespace Drupal\imagick\Plugin\ImageToolkit\Operation\imagick;
use Imagick;
class Opacity extends ImagickOperationBase {
protected function arguments() {
return [
'alpha' => [
'description' => 'The transparency of the overlay layer.',
],
];
}
protected function process(Imagick $resource, array $arguments) {
$opacity = $arguments['alpha'] / 100;
if (method_exists($resource, 'setImageOpacity')) {
return $resource
->setImageOpacity($opacity);
}
else {
return $resource
->setImageAlpha($opacity);
}
}
}
Classes
Name |
Description |
Opacity |
Defines imagick opacity operation. |