Added option to disable imagick (#211)

This commit is contained in:
Tobias Reich 2014-08-30 00:11:26 +02:00
parent 62b7c2e542
commit 0296b313ee
3 changed files with 17 additions and 3 deletions

View File

@ -28,6 +28,18 @@ while ($photo = $result->fetch_object()) {
}
}
# Add Imagick
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'imagick' LIMIT 1", [LYCHEE_TABLE_SETTINGS]);
$result = $database->query($query);
if ($result->num_rows===0) {
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('imagick', '1')", [LYCHEE_TABLE_SETTINGS]);
$result = $database->query($query);
if (!$result) {
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
}
# Set version
$query = Database::prepare($database, "UPDATE ? SET value = '020602' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
$result = $database->query($query);

View File

@ -241,7 +241,7 @@ class Photo extends Module {
$newUrl2x = LYCHEE_UPLOADS_THUMB . $photoName[0] . '@2x.jpeg';
# create thumbnails with Imagick
if(extension_loaded('imagick')) {
if(extension_loaded('imagick')&&$this->settings['imagick']==='1') {
# Read image
$thumb = new Imagick();
@ -319,7 +319,7 @@ class Photo extends Module {
# Call plugins
$this->plugins(__METHOD__, 0, func_get_args());
if (extension_loaded('imagick')) {
if (extension_loaded('imagick')&&$this->settings['imagick']==='1') {
$rotateImage = 0;

View File

@ -63,7 +63,8 @@ if (!isset($settings['password'])||$settings['password']=='') $error .= ('Erro
if (!isset($settings['thumbQuality'])||$settings['thumbQuality']=='') $error .= ('Error 406: No or wrong property for thumbQuality in database' . PHP_EOL);
if (!isset($settings['sorting'])||$settings['sorting']=='') $error .= ('Error 407: Wrong property for sorting in database' . PHP_EOL);
if (!isset($settings['plugins'])) $error .= ('Error 408: No property for plugins in database' . PHP_EOL);
if (!isset($settings['checkForUpdates'])||($settings['checkForUpdates']!='0'&&$settings['checkForUpdates']!='1')) $error .= ('Error 409: No or wrong property for checkForUpdates in database' . PHP_EOL);
if (!isset($settings['imagick'])||$settings['imagick']=='') $error .= ('Error 409: No or wrong property for imagick in database' . PHP_EOL);
if (!isset($settings['checkForUpdates'])||($settings['checkForUpdates']!='0'&&$settings['checkForUpdates']!='1')) $error .= ('Error 410: No or wrong property for checkForUpdates in database' . PHP_EOL);
# Permissions
if (hasPermissions(LYCHEE_UPLOADS_BIG)===false) $error .= ('Error 500: Wrong permissions for \'uploads/big\' (777 required)' . PHP_EOL);
@ -100,6 +101,7 @@ echo('System: ' . PHP_OS . PHP_EOL);
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
echo('Imagick: ' . extension_loaded('imagick') . PHP_EOL);
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
echo('Imagick Version: ' . @Imagick::getVersion()['versionNumber'] . PHP_EOL);
echo('GD Version: ' . gd_info()['GD Version'] . PHP_EOL);