r65968 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65967‎ | r65968 | r65969 >
Date:22:37, 5 May 2010
Author:hartman
Status:ok
Tags:
Comment:
Add a isAnimatedImage() helper function to imagehandlers.

Should return true for animated GIFs and hopefully soon for APNGs
Modified paths:
  • /trunk/phase3/includes/media/GIF.php (modified) (history)
  • /trunk/phase3/includes/media/Generic.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/media/Generic.php
@@ -424,6 +424,10 @@
425425 return $gis;
426426 }
427427
 428+ function isAnimatedImage( $image ) {
 429+ return false;
 430+ }
 431+
428432 function getShortDesc( $file ) {
429433 global $wgLang;
430434 $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
Index: trunk/phase3/includes/media/GIF.php
@@ -39,6 +39,15 @@
4040 return $width * $height;
4141 }
4242 }
 43+
 44+ function isAnimatedImage( $image ) {
 45+ $ser = $image->getMetadata();
 46+ if ($ser) {
 47+ $metadata = unserialize($ser);
 48+ if( $metadata['frameCount'] > 1 ) return true;
 49+ }
 50+ return false;
 51+ }
4352
4453 function getMetadataType( $image ) {
4554 return 'parsed-gif';

Status & tagging log