You are here

private function ImagickToolkit::copyRemoteFileToLocalTemp in Imagick 8

Given a remote source it will copy its contents to a local temporary file.

Parameters

$source:

Return value

bool

1 call to ImagickToolkit::copyRemoteFileToLocalTemp()
ImagickToolkit::getPath in src/Plugin/ImageToolkit/ImagickToolkit.php
ensure that we have a local filepath since Imagick does not support remote stream wrappers

File

src/Plugin/ImageToolkit/ImagickToolkit.php, line 388

Class

ImagickToolkit
Defines the Imagick toolkit for image manipulation within Drupal.

Namespace

Drupal\imagick\Plugin\ImageToolkit

Code

private function copyRemoteFileToLocalTemp($source) {
  if (!($tmp_file = $this->fileSystem
    ->copy($source, $this->fileSystem
    ->tempnam(self::TEMP_DIR, self::TEMP_PREFIX), FileSystemInterface::EXISTS_REPLACE))) {
    return FALSE;
  }
  return $this->fileSystem
    ->realpath($tmp_file);
}