check the imagick version before using it.

This commit is contained in:
friendica 2014-10-07 15:14:06 -07:00
parent 563163523d
commit 14d538c793
2 changed files with 17 additions and 5 deletions

View File

@ -2,13 +2,25 @@
function photo_factory($data, $type = null) { function photo_factory($data, $type = null) {
$ph = null; $ph = null;
$ignore_imagick = get_config('system', 'ignore_imagick'); $ignore_imagick = get_config('system', 'ignore_imagick');
if(class_exists('Imagick') && !$ignore_imagick) { if(class_exists('Imagick') && !$ignore_imagick) {
logger('photo_factory: using Imagick', LOGGER_DEBUG); $v = Imagick::getVersion();
require_once('include/photo/photo_imagick.php'); preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $m);
$ph = new photo_imagick($data,$type); if(version_compare($m[1],'6.6.7') >= 0) {
require_once('include/photo/photo_imagick.php');
$ph = new photo_imagick($data,$type);
}
else {
// earlier imagick versions have issues with scaling png's
// don't log this because it will just fill the logfile.
// leave this note here so those who are looking for why
// we aren't using imagick can find it
}
} }
else {
if(! $ph) {
require_once('include/photo/photo_gd.php'); require_once('include/photo/photo_gd.php');
$ph = new photo_gd($data,$type); $ph = new photo_gd($data,$type);
} }

View File

@ -1 +1 @@
2014-10-06.820 2014-10-07.821