Mercurial > hg > mgallery
comparison mgtool.php @ 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 | 3c9ce1ad3c45 |
children | a31ff7ecb785 |
comparison
equal
deleted
inserted
replaced
263:6a9e6277ef3c | 264:745af791367d |
---|---|
50 // the intermediate size images and thumbnails. Uses the | 50 // the intermediate size images and thumbnails. Uses the |
51 // PHP ImageMagick or GraphicsMagick bindings. | 51 // PHP ImageMagick or GraphicsMagick bindings. |
52 // | 52 // |
53 function mgConvertImage($inFilename, $outFilename, $outDim, $outFormat, $outQuality, $thumb) | 53 function mgConvertImage($inFilename, $outFilename, $outDim, $outFormat, $outQuality, $thumb) |
54 { | 54 { |
55 if (extension_loaded("imagick") && extension_loaded("gmagick")) | |
56 { | |
57 mgError("FATAL ERROR! Both ImageMagick AND GraphicsMagick modules enabled in PHP! This will cause problems! Refusing to work.\n"); | |
58 exit(1); | |
59 } | |
60 | |
61 if (extension_loaded("imagick")) | 55 if (extension_loaded("imagick")) |
62 { | 56 { |
63 // Create conversion entity | 57 // Create conversion entity |
64 try | 58 try |
65 { | 59 { |
203 // if (!empty($profiles)) | 197 // if (!empty($profiles)) |
204 // $img->profileImage("icc", $profiles); | 198 // $img->profileImage("icc", $profiles); |
205 | 199 |
206 $img->writeImage($outFilename); | 200 $img->writeImage($outFilename); |
207 $img->removeImage(); | 201 $img->removeImage(); |
208 } | |
209 else | |
210 { | |
211 return mgError("No ImageMagick OR GraphicsMagick module in PHP!\n"); | |
212 } | 202 } |
213 | 203 |
214 return TRUE; | 204 return TRUE; |
215 } | 205 } |
216 | 206 |
964 pcntl_signal(SIGTERM, "mgSigHandler"); | 954 pcntl_signal(SIGTERM, "mgSigHandler"); |
965 pcntl_signal(SIGHUP, "mgSigHandler"); | 955 pcntl_signal(SIGHUP, "mgSigHandler"); |
966 pcntl_signal(SIGQUIT, "mgSigHandler"); | 956 pcntl_signal(SIGQUIT, "mgSigHandler"); |
967 pcntl_signal(SIGINT, "mgSigHandler"); | 957 pcntl_signal(SIGINT, "mgSigHandler"); |
968 | 958 |
959 if (extension_loaded("imagick") && extension_loaded("gmagick")) | |
960 { | |
961 mgError("FATAL ERROR! Both ImageMagick AND GraphicsMagick modules enabled in PHP! This will cause problems! Refusing to work.\n"); | |
962 exit(1); | |
963 } | |
964 else | |
965 if (!extension_loaded("imagick") && !extension_loaded("gmagick")) | |
966 { | |
967 mgError("No ImageMagick OR GraphicsMagick module available in PHP!\n"); | |
968 exit(1); | |
969 } | |
970 | |
969 if (mgReadSettings() === FALSE) | 971 if (mgReadSettings() === FALSE) |
970 die("MGallery is not configured, failed to find a configuration file.\n"); | 972 die("MGallery is not configured, failed to find a configuration file.\n"); |
971 | 973 |
972 if (($pageTimeZone = mgGetSetting("timezone")) !== NULL) | 974 if (($pageTimeZone = mgGetSetting("timezone")) !== NULL) |
973 date_default_timezone_set($pageTimeZone); | 975 date_default_timezone_set($pageTimeZone); |