You are here

protected function GaussianBlur::execute in Image Effects 8.3

Same name in this branch
  1. 8.3 src/Plugin/ImageToolkit/Operation/gd/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GaussianBlur::execute()
  2. 8.3 src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\GaussianBlur::execute()
Same name and namespace in other branches
  1. 8 src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\GaussianBlur::execute()
  2. 8.2 src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\GaussianBlur::execute()

File

src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php, line 26

Class

GaussianBlur
Defines ImageMagick Gaussian Blur operation.

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick

Code

protected function execute(array $arguments) {
  switch ($this
    ->getToolkit()
    ->getExecManager()
    ->getPackage()) {
    case 'imagemagick':
      $op = '-channel RGBA -blur ' . $arguments['radius'];
      break;
    case 'graphicsmagick':
      $op = '-gaussian ' . $arguments['radius'];
      break;
  }
  $sigma = $arguments['sigma'] !== NULL ? $arguments['sigma'] : $arguments['radius'] / 3 * 2;
  $op .= 'x' . number_format($sigma, 1, '.', '');
  $this
    ->addArgument($op);
  return TRUE;
}