You are here

public function ImagemagickToolkit::ensureSourceLocalPath in ImageMagick 8.3

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

Ensures that the local filesystem path to the image file exists.

Return value

string A filesystem path.

1 call to ImagemagickToolkit::ensureSourceLocalPath()
ImagemagickToolkit::convert in src/Plugin/ImageToolkit/ImagemagickToolkit.php
Calls the convert executable with the specified arguments.

File

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

Class

ImagemagickToolkit
Provides ImageMagick integration toolkit for image manipulation.

Namespace

Drupal\imagemagick\Plugin\ImageToolkit

Code

public function ensureSourceLocalPath() : string {

  // If sourceLocalPath is NULL, then ensure it is prepared. This can
  // happen if image was identified via cached metadata: the cached data are
  // available, but the temp file path is not resolved, or even the temp file
  // could be missing if it was copied locally from a remote file system.
  if (!$this
    ->arguments()
    ->getSourceLocalPath() && $this
    ->getSource()) {
    $this->eventDispatcher
      ->dispatch(ImagemagickExecutionEvent::ENSURE_SOURCE_LOCAL_PATH, new ImagemagickExecutionEvent($this->arguments));
  }
  return $this
    ->arguments()
    ->getSourceLocalPath();
}