From: Brian Wolff Date: Fri, 4 Jul 2014 02:07:38 +0000 (-0300) Subject: Don't try to render indexed xcf images with image magick. X-Git-Tag: 1.31.0-rc.0~15096^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=22b5a763c9f9b2be74861a56eb1d42406885bee5;p=lhc%2Fweb%2Fwiklou.git Don't try to render indexed xcf images with image magick. Image magick doesn't support them. See some discussion at bug 35622 comment 9 Change-Id: I127bcb5458a4c06f043a4f5d0ae6d70bd7809e64 --- diff --git a/includes/media/XCF.php b/includes/media/XCF.php index 658112ff7c..b303a0130f 100644 --- a/includes/media/XCF.php +++ b/includes/media/XCF.php @@ -212,4 +212,20 @@ class XCFHandler extends BitmapHandler { protected static function getScalerType( $dstPath, $checkDstPath = true ) { return "im"; } + + /** + * Can we render this file? + * + * Image magick doesn't support indexed xcf files as of current + * writing (as of 6.8.9-3) + */ + public function canRender( $file ) { + wfSuppressWarnings(); + $xcfMeta = unserialize( $file->getMetadata() ); + wfRestoreWarnings(); + if ( isset( $xcfMeta['colorType'] ) && $xcfMeta['colorType'] === 'index-coloured' ) { + return false; + } + return parent::canRender( $file ); + } }