r84362 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84361‎ | r84362 | r84363 >
Date:00:23, 20 March 2011
Author:bawolff
Status:ok
Tags:
Comment:
In my testing, some programs (like Wikimedia's image scalars) repeat the same comment over and over
again in animated GIF images (one for each frame). Make it so if the previous comment was exact same
as the current one, not to save the current one.

I haven't looked at all this code in a while. I plan to take a look at it with fresh eyes, and then try and be
annoying about getting it merged in ;)
Modified paths:
  • /branches/img_metadata/phase3/includes/media/GIFMetadataExtractor.php (modified) (history)

Diff [purge]

Index: branches/img_metadata/phase3/includes/media/GIFMetadataExtractor.php
@@ -130,8 +130,15 @@
131131 wfRestoreWarnings();
132132 }
133133
134 - $comment[] = $data;
135 -
 134+ $commentCount = count( $comment );
 135+ if ( $commentCount === 0
 136+ || $comment[$commentCount-1] !== $data )
 137+ {
 138+ // Some applications repeat the same comment on each
 139+ // frame of an animated GIF image, so if this comment
 140+ // is identical to the last, only extract once.
 141+ $comment[] = $data;
 142+ }
136143 } elseif ($extension_code == 0xFF) {
137144 // Application extension (Netscape info about the animated gif)
138145 // or XMP (or theoretically any other type of extension block)

Status & tagging log