Don't try to render indexed xcf images with image magick.
authorBrian Wolff <bawolff+wn@gmail.com>
Fri, 4 Jul 2014 02:07:38 +0000 (23:07 -0300)
committerBrian Wolff <bawolff+wn@gmail.com>
Fri, 4 Jul 2014 02:07:38 +0000 (23:07 -0300)
Image magick doesn't support them.

See some discussion at bug 35622 comment 9

Change-Id: I127bcb5458a4c06f043a4f5d0ae6d70bd7809e64

includes/media/XCF.php

index 658112f..b303a01 100644 (file)
@@ -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 );
+       }
 }