Opacity.php in Image Effects 8.2
Same filename in this branch
Same filename and directory in other branches
File
src/Plugin/ImageToolkit/Operation/gd/Opacity.phpView source
<?php
namespace Drupal\image_effects\Plugin\ImageToolkit\Operation\gd;
use Drupal\system\Plugin\ImageToolkit\Operation\gd\GDImageToolkitOperationBase;
use Drupal\image_effects\Plugin\ImageToolkit\Operation\OpacityTrait;
/**
* Defines GD Opacity operation.
*
* @ImageToolkitOperation(
* id = "image_effects_gd_opacity",
* toolkit = "gd",
* operation = "opacity",
* label = @Translation("Opacity"),
* description = @Translation("Adjust image transparency.")
* )
*/
class Opacity extends GDImageToolkitOperationBase {
use GDOperationTrait;
use OpacityTrait;
/**
* {@inheritdoc}
*/
protected function execute(array $arguments) {
if ($arguments['opacity'] < 100) {
return $this
->filterOpacity($this
->getToolkit()
->getResource(), $arguments['opacity']);
}
return TRUE;
}
}