diff --git a/application/src/File/Thumbnailer/ImageMagick.php b/application/src/File/Thumbnailer/ImageMagick.php index 4caa6c056a..19637dc285 100644 --- a/application/src/File/Thumbnailer/ImageMagick.php +++ b/application/src/File/Thumbnailer/ImageMagick.php @@ -8,9 +8,10 @@ class ImageMagick extends AbstractThumbnailer { const CONVERT_COMMAND = 'convert'; + const MAGICK_COMMAND = 'magick'; /** - * @var string Path to the ImageMagick "convert" command + * @var string Path to command "magick" (ImageMagick v7) or "convert" (v6). */ protected $convertPath; @@ -102,7 +103,7 @@ public function create($strategy, $constraint, array $options = []) } /** - * Set the path to the ImageMagick "convert" command. + * Set the path to command "magick" (ImageMagick v7) or "convert" (v6). * * @param string $convertDir */ @@ -110,12 +111,18 @@ public function setConvertPath($convertDir) { $cli = $this->cli; if ($convertDir) { - $convertPath = $cli->validateCommand($convertDir, self::CONVERT_COMMAND); + $convertPath = $cli->validateCommand($convertDir, self::MAGICK_COMMAND); + if (false === $convertPath) { + $convertPath = $cli->validateCommand($convertDir, self::CONVERT_COMMAND); + } if (false === $convertPath) { throw new Exception\InvalidThumbnailerException('ImageMagick error: invalid ImageMagick command.'); } } else { - $convertPath = $cli->getCommandPath(self::CONVERT_COMMAND); + $convertPath = $cli->getCommandPath(self::MAGICK_COMMAND); + if (false === $convertPath) { + $convertPath = $cli->getCommandPath(self::CONVERT_COMMAND); + } if (false === $convertPath) { throw new Exception\InvalidThumbnailerException('ImageMagick error: cannot determine path to ImageMagick command.'); }