public function load($imagePath, $options = [])
{
// support image URLs
if (preg_match("@^https?://@", $imagePath)) {
$tmpFilename = "imagick_auto_download_" . md5($imagePath) . "." . File::getFileExtension($imagePath);
$tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/" . $tmpFilename;
$this->tmpFiles[] = $tmpFilePath;
File::put($tmpFilePath, \Pimcore\Tool::getHttpData($imagePath));
$imagePath = $tmpFilePath;
}
if (!stream_is_local($imagePath)) {
// imagick is only able to deal with local files
// if your're using custom stream wrappers this wouldn't work, so we create a temp. local copy
$tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/imagick-tmp-" . uniqid() . "." . File::getFileExtension($imagePath);
copy($imagePath, $tmpFilePath);
$imagePath = $tmpFilePath;
$this->tmpFiles[] = $imagePath;
}
$this->imagePath = $imagePath;
$this->initResource();
$this->setModified(false);
return $this;
}