r64692 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64691‎ | r64692 | r64693 >
Date:05:41, 7 April 2010
Author:vyznev
Status:ok (Comments)
Tags:
Comment:
(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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/media/Bitmap.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/media/Bitmap.php
@@ -34,7 +34,7 @@
3535 # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
3636 # an exception for it.
3737 if ( $mimeType !== 'image/jpeg' &&
38 - $this->getImageArea( $image, $srcWidth, $srcHeight ) > $wgMaxImageArea )
 38+ $srcWidth * $srcHeight > $wgMaxImageArea )
3939 {
4040 return false;
4141 }
@@ -124,7 +124,7 @@
125125 } elseif ( $mimeType == 'image/png' ) {
126126 $quality = "-quality 95"; // zlib 9, adaptive filtering
127127 } elseif( $mimeType == 'image/gif' ) {
128 - if( $srcWidth * $srcHeight > $wgMaxAnimatedGifArea ) {
 128+ if( $this->getImageArea( $image, $srcWidth, $srcHeight ) > $wgMaxAnimatedGifArea ) {
129129 // Extract initial frame only; we're so big it'll
130130 // be a total drag. :P
131131 $frame = '[0]';
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2349,11 +2349,11 @@
23502350 $wgMaxImageArea = 1.25e7;
23512351 /**
23522352 * Force thumbnailing of animated GIFs above this size to a single
2353 - * frame instead of an animated thumbnail. ImageMagick seems to
2354 - * get real unhappy and doesn't play well with resource limits. :P
2355 - * Defaulting to 1 megapixel (1000x1000)
 2353+ * frame instead of an animated thumbnail. As of MW 1.17 this limit
 2354+ * is checked against the total size of all frames in the animation.
 2355+ * It probably makes sense to keep this equal to $wgMaxImageArea.
23562356 */
2357 -$wgMaxAnimatedGifArea = 1.0e6;
 2357+$wgMaxAnimatedGifArea = 1.25e7;
23582358 /**
23592359 * Browsers don't support TIFF inline generally...
23602360 * For inline display, we need to convert to PNG or JPEG.
Index: trunk/phase3/RELEASE-NOTES
@@ -88,6 +88,10 @@
8989 * (bug 20049) Fixed PHP notice in search highlighter that occurs in some cases
9090 * (bug 23017) Special:Disambiguations now list pages in content namespaces
9191 rather than only main namespace
 92+* (bug 23063) $wgMaxAnimatedGifArea is checked against the total size of all
 93+ frames, and $wgMaxImageArea against the size of the first frame, rather than
 94+ the other way around. Both now default to 12.5 megapixels. Also, images
 95+ exceeding $wgMaxImageArea can still be embedded at original size
9296
9397 === API changes in 1.17 ===
9498 * (bug 22738) Allow filtering by action type on query=logevent

Follow-up revisions

RevisionCommit summaryAuthorDate
r647271.16wmf3: MFT r64691, r64692 for GIF scaling fixeswerdna02:48, 8 April 2010
r647281.16wmf4: MFT r64691, r64692 for GIF scaling fixeswerdna02:55, 8 April 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64691allow display of unscaled image even if it exceeds $wgMaxImageArea (this can ...vyznev05:17, 7 April 2010

Comments

#Comment by Werdna (talk | contribs)   02:37, 8 April 2010

Looks fine, going to deploy.

Status & tagging log