You are here

protected function Replace::execute in Image Replace 8

Same name in this branch
  1. 8 src/Plugin/ImageToolkit/Operation/gd/Replace.php \Drupal\image_replace\Plugin\ImageToolkit\Operation\gd\Replace::execute()
  2. 8 src/Plugin/ImageToolkit/Operation/imagemagick/Replace.php \Drupal\image_replace\Plugin\ImageToolkit\Operation\imagemagick\Replace::execute()

File

src/Plugin/ImageToolkit/Operation/imagemagick/Replace.php, line 46

Class

Replace
Defines Imagegemagick image_replace operation.

Namespace

Drupal\image_replace\Plugin\ImageToolkit\Operation\imagemagick

Code

protected function execute(array $arguments = array()) {
  $replacement = $arguments['replacement_image']
    ->getToolkit();

  // Replace original image's source with replacement image's source
  $this
    ->getToolkit()
    ->arguments()
    ->setSource($replacement
    ->arguments()
    ->getSource());
  $this
    ->getToolkit()
    ->setWidth($replacement
    ->getWidth())
    ->setHeight($replacement
    ->getHeight());
  return TRUE;
}