changeset 264:745af791367d

Move Imagick/Gmagick module check to script startup.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 16 Dec 2018 17:45:51 +0200
parents 6a9e6277ef3c
children a31ff7ecb785
files mgtool.php
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mgtool.php	Sun Dec 16 17:45:00 2018 +0200
+++ b/mgtool.php	Sun Dec 16 17:45:51 2018 +0200
@@ -52,12 +52,6 @@
 //
 function mgConvertImage($inFilename, $outFilename, $outDim, $outFormat, $outQuality, $thumb)
 {
-  if (extension_loaded("imagick") && extension_loaded("gmagick"))
-  {
-    mgError("FATAL ERROR! Both ImageMagick AND GraphicsMagick modules enabled in PHP! This will cause problems! Refusing to work.\n");
-    exit(1);
-  }
-
   if (extension_loaded("imagick"))
   {
     // Create conversion entity
@@ -206,10 +200,6 @@
     $img->writeImage($outFilename);
     $img->removeImage();
   }
-  else
-  {
-    return mgError("No ImageMagick OR GraphicsMagick module in PHP!\n");
-  }
 
   return TRUE;
 }
@@ -966,6 +956,18 @@
 pcntl_signal(SIGQUIT, "mgSigHandler");
 pcntl_signal(SIGINT,  "mgSigHandler");
 
+if (extension_loaded("imagick") && extension_loaded("gmagick"))
+{
+  mgError("FATAL ERROR! Both ImageMagick AND GraphicsMagick modules enabled in PHP! This will cause problems! Refusing to work.\n");
+  exit(1);
+}
+else
+if (!extension_loaded("imagick") && !extension_loaded("gmagick"))
+{
+  mgError("No ImageMagick OR GraphicsMagick module available in PHP!\n");
+  exit(1);
+}
+
 if (mgReadSettings() === FALSE)
   die("MGallery is not configured, failed to find a configuration file.\n");