Add a isAnimatedImage() helper function to imagehandlers.
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 5 May 2010 22:37:27 +0000 (22:37 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 5 May 2010 22:37:27 +0000 (22:37 +0000)
Should return true for animated GIFs and hopefully soon for APNGs

includes/media/GIF.php
includes/media/Generic.php

index 5d1f9db..434762f 100644 (file)
@@ -39,6 +39,15 @@ class GIFHandler extends BitmapHandler {
                        return $width * $height;
                }
        }
+
+       function isAnimatedImage( $image ) {
+               $ser = $image->getMetadata();
+               if ($ser) {
+                       $metadata = unserialize($ser);
+                       if( $metadata['frameCount'] > 1 ) return true;
+               }
+               return false;
+       }
        
        function getMetadataType( $image ) {
                return 'parsed-gif';
index 8a4d705..a4bd7cd 100644 (file)
@@ -424,6 +424,10 @@ abstract class ImageHandler extends MediaHandler {
                return $gis;
        }
 
+       function isAnimatedImage( $image ) {
+               return false;
+       }
+
        function getShortDesc( $file ) {
                global $wgLang;
                $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),