Watermark.php in Image Effects 8
File
src/Plugin/ImageToolkit/Operation/gd/Watermark.php
View 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\WatermarkTrait;
class Watermark extends GDImageToolkitOperationBase {
use GDOperationTrait;
use WatermarkTrait;
protected function execute(array $arguments) {
$watermark = $arguments['watermark_image'];
if ($arguments['watermark_width'] || $arguments['watermark_height']) {
$watermark
->apply('resize', [
'width' => $arguments['watermark_width'],
'height' => $arguments['watermark_height'],
]);
}
return $this
->imageCopyMergeAlpha($this
->getToolkit()
->getResource(), $watermark
->getToolkit()
->getResource(), $arguments['x_offset'], $arguments['y_offset'], 0, 0, $watermark
->getToolkit()
->getWidth(), $watermark
->getToolkit()
->getHeight(), $arguments['opacity']);
}
}