(bug 23063) Reverse handling of $wgMaxImageArea and $wgMaxAnimatedGifArea: the former...
authorIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 7 Apr 2010 05:41:44 +0000 (05:41 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 7 Apr 2010 05:41:44 +0000 (05:41 +0000)
The way the logic and the defaults were before, it was basically impossible for animations with more than 12 frames to reach the "only thumbnail first frame" codepath; this surely cannot have been intended.
Also mention r64691 in release notes.

RELEASE-NOTES
includes/DefaultSettings.php
includes/media/Bitmap.php

index 21e0b22..29a9864 100644 (file)
@@ -88,6 +88,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 20049) Fixed PHP notice in search highlighter that occurs in some cases
 * (bug 23017) Special:Disambiguations now list pages in content namespaces
   rather than only main namespace
+* (bug 23063) $wgMaxAnimatedGifArea is checked against the total size of all
+  frames, and $wgMaxImageArea against the size of the first frame, rather than
+  the other way around.  Both now default to 12.5 megapixels.  Also, images
+  exceeding $wgMaxImageArea can still be embedded at original size
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent
index c0e5b2e..9633540 100644 (file)
@@ -2349,11 +2349,11 @@ $wgSVGMaxSize = 2048;
 $wgMaxImageArea = 1.25e7;
 /**
  * Force thumbnailing of animated GIFs above this size to a single
- * frame instead of an animated thumbnail. ImageMagick seems to
- * get real unhappy and doesn't play well with resource limits. :P
- * Defaulting to 1 megapixel (1000x1000)
+ * frame instead of an animated thumbnail.  As of MW 1.17 this limit
+ * is checked against the total size of all frames in the animation.
+ * It probably makes sense to keep this equal to $wgMaxImageArea.
  */
-$wgMaxAnimatedGifArea = 1.0e6;
+$wgMaxAnimatedGifArea = 1.25e7;
 /**
  * Browsers don't support TIFF inline generally...
  * For inline display, we need to convert to PNG or JPEG.
index 536797d..d004659 100644 (file)
@@ -34,7 +34,7 @@ class BitmapHandler extends ImageHandler {
                # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
                # an exception for it.
                if ( $mimeType !== 'image/jpeg' &&
-                       $this->getImageArea( $image, $srcWidth, $srcHeight ) > $wgMaxImageArea )
+                       $srcWidth * $srcHeight > $wgMaxImageArea )
                {
                        return false;
                }
@@ -124,7 +124,7 @@ class BitmapHandler extends ImageHandler {
                        } elseif ( $mimeType == 'image/png' ) {
                                $quality = "-quality 95"; // zlib 9, adaptive filtering
                        } elseif( $mimeType == 'image/gif' ) {
-                               if( $srcWidth * $srcHeight > $wgMaxAnimatedGifArea ) {
+                               if( $this->getImageArea( $image, $srcWidth, $srcHeight ) > $wgMaxAnimatedGifArea ) {
                                        // Extract initial frame only; we're so big it'll
                                        // be a total drag. :P
                                        $frame = '[0]';