From 9686c4bf20ac1ba55a2da64e9515dfc09b835e7a Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Wed, 7 Apr 2010 05:41:44 +0000 Subject: [PATCH] (bug 23063) Reverse handling of $wgMaxImageArea and $wgMaxAnimatedGifArea: the former is now compared to the size of the first frame and the latter to the total size of all frames. Also increase default value of $wgMaxAnimatedGifArea to match $wgMaxImageArea. This change should not affect the thumbnailing of non-animated images in any way. 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 | 4 ++++ includes/DefaultSettings.php | 8 ++++---- includes/media/Bitmap.php | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 21e0b229e5..29a9864baf 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index c0e5b2e3fc..963354064e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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. diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 536797d296..d004659b76 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -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]'; -- 2.20.1