You are here

public function ImagemagickToolkit::ensureSourceLocalPath in ImageMagick 8.2

Same name and namespace in other branches
  1. 8.3 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.

3 calls to ImagemagickToolkit::ensureSourceLocalPath()
ImagemagickToolkit::convert in src/Plugin/ImageToolkit/ImagemagickToolkit.php
Calls the convert executable with the specified arguments.
ImagemagickToolkit::getExifOrientation in src/Plugin/ImageToolkit/ImagemagickToolkit.php
Gets the source EXIF orientation.
ImagemagickToolkit::getSourceLocalPath in src/Plugin/ImageToolkit/ImagemagickToolkit.php
Gets the local filesystem path to the image file.

File

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

Class

ImagemagickToolkit
Provides ImageMagick integration toolkit for image manipulation.

Namespace

Drupal\imagemagick\Plugin\ImageToolkit

Code

public function ensureSourceLocalPath() {

  // 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->moduleHandler
      ->alterDeprecated('Deprecated in 8.x-2.5, will be removed in 8.x-3.0. Use an event subscriber to react on a ImagemagickExecutionEvent::ENSURE_SOURCE_LOCAL_PATH event. See https://www.drupal.org/project/imagemagick/issues/3043136.', 'imagemagick_pre_parse_file', $this->arguments);
    $this->eventDispatcher
      ->dispatch(ImagemagickExecutionEvent::ENSURE_SOURCE_LOCAL_PATH, new ImagemagickExecutionEvent($this->arguments));
  }
  return $this
    ->arguments()
    ->getSourceLocalPath();
}