Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions application/src/File/Thumbnailer/ImageMagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -102,20 +103,26 @@ 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
*/
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.');
}
Expand Down