From 7f0561881110bc476789cf151d5a823c786f091a Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Tue, 18 Aug 2020 18:51:32 -0700 Subject: [PATCH] Show error when ImageMagick is enabled but is not installed --- inc/functions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 6a582f5..fec480b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -506,8 +506,15 @@ function createThumbnail($file_location, $thumb_location, $new_w, $new_h) { imagedestroy($dst_img); imagedestroy($src_img); - } else { // imagemagick + } else { // ImageMagick $discard = ''; + + $exit_status = 1; + exec("convert -version", $discard, $exit_status); + if ($exit_status != 0) { + fancyDie('ImageMagick is not installed, or the convert command is not in the server\'s $PATH.
Install ImageMagick, or set TINYIB_THUMBNAIL to \'gd\'.'); + } + $exit_status = 1; exec("convert $file_location -auto-orient -thumbnail '" . $new_w . "x" . $new_h . "' -coalesce -layers OptimizeFrame -depth 4 -type palettealpha $thumb_location", $discard, $exit_status);