You are here

public function ImagemagickToolkit::save in ImageMagick 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/ImageToolkit/ImagemagickToolkit.php \Drupal\imagemagick\Plugin\ImageToolkit\ImagemagickToolkit::save()
  2. 8.2 src/Plugin/ImageToolkit/ImagemagickToolkit.php \Drupal\imagemagick\Plugin\ImageToolkit\ImagemagickToolkit::save()

Writes an image resource to a destination file.

Parameters

string $destination: A string file URI or path where the image should be saved.

Return value

bool TRUE on success, FALSE on failure.

Overrides ImageToolkitInterface::save

File

src/Plugin/ImageToolkit/ImagemagickToolkit.php, line 720

Class

ImagemagickToolkit
Provides ImageMagick integration toolkit for image manipulation.

Namespace

Drupal\imagemagick\Plugin\ImageToolkit

Code

public function save($destination) {
  $this
    ->arguments()
    ->setDestination($destination);
  if ($ret = $this
    ->convert()) {

    // Allow modules to alter the destination file.
    $this->eventDispatcher
      ->dispatch(ImagemagickExecutionEvent::POST_SAVE, new ImagemagickExecutionEvent($this->arguments));

    // Reset local path to allow saving to other file.
    $this
      ->arguments()
      ->setDestinationLocalPath('');
  }
  return $ret;
}