From b595f9d3ee265abc9730f31dd98d75cca03c6e84 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Oct 2014 20:42:57 -0700 Subject: log the recursive reshare from hell at logger_debug until we get through this mess. --- include/diaspora.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index f650f0831..f0687e51e 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -907,12 +907,12 @@ function get_diaspora_reshare_xml($url,$recurse = 0) { $x = z_fetch_url($url); if(! $x['success']) - $x = z_fetch_url(str_replace('https://','http://',$source_url)); + $x = z_fetch_url(str_replace('https://','http://',$url)); if(! $x['success']) { - logger('get_diaspora_reshare_xml: unable to fetch source url ' . $source_url); + logger('get_diaspora_reshare_xml: unable to fetch source url ' . $url); return; } - logger('diaspora_reshare: source: ' . $x['body'], LOGGER_DATA); + logger('get_diaspora_reshare_xml: source: ' . $x['body'], LOGGER_DEBUG); $source_xml = parse_xml_string($x['body'],false); -- cgit v1.2.3 From ee6c53c2e54619a39e16ac2176835adea3b73778 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Oct 2014 21:16:30 -0700 Subject: add imagick version check when guessing mimetype. It probably isn't important here, but let's make sure we have the right driver installed if we do something else with photos afterward. --- include/photo/photo_driver.php | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 42997060b..c416c0df3 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -512,19 +512,30 @@ function guess_image_type($filename, $headers = '') { $type = $hdrs['Content-Type']; } if (is_null($type)){ -// FIXME!!!! + $ignore_imagick = get_config('system', 'ignore_imagick'); // Guessing from extension? Isn't that... dangerous? if(class_exists('Imagick') && !$ignore_imagick) { - logger('using imagemagick', LOGGER_DEBUG); - /** - * Well, this not much better, - * but at least it comes from the data inside the image, - * we won't be tricked by a manipulated extension - */ - $image = new Imagick($filename); - $type = $image->getImageMimeType(); - } else { + $v = Imagick::getVersion(); + preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $m); + if(version_compare($m[1],'6.6.7') >= 0) { + /** + * Well, this not much better, + * but at least it comes from the data inside the image, + * we won't be tricked by a manipulated extension + */ + $image = new Imagick($filename); + $type = $image->getImageMimeType(); + } + 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 + } + } + + if(is_null($type)) { $ext = pathinfo($filename, PATHINFO_EXTENSION); $ph = photo_factory(''); $types = $ph->supportedTypes(); -- cgit v1.2.3