ImagemagickArgumentsTrait.php in Image Effects 8.2
File
src/Plugin/ImageToolkit/Operation/ImagemagickArgumentsTrait.php
View source
<?php
namespace Drupal\image_effects\Plugin\ImageToolkit\Operation;
trait ImagemagickArgumentsTrait {
protected function arguments() {
return [
'command_line' => [
'description' => 'Command line arguments.',
],
'width' => [
'description' => 'Width of image after operation.',
],
'height' => [
'description' => 'Height of image after operation.',
],
];
}
protected function validateArguments(array $arguments) {
$arguments['width'] = $arguments['width'] !== NULL ? (int) $arguments['width'] : NULL;
if ($arguments['width'] !== NULL && $arguments['width'] <= 0) {
throw new \InvalidArgumentException("Invalid width ('{$arguments['width']}') specified for the image 'imagemagick_arguments' operation");
}
$arguments['height'] = $arguments['height'] !== NULL ? (int) $arguments['height'] : NULL;
if ($arguments['height'] !== NULL && $arguments['height'] <= 0) {
throw new \InvalidArgumentException("Invalid height ('{$arguments['height']}') specified for the image 'imagemagick_arguments' operation");
}
return $arguments;
}
}