r64727 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64726‎ | r64727 | r64728 >
Date:02:48, 8 April 2010
Author:werdna
Status:deferred
Tags:
Comment:
1.16wmf3: MFT r64691, r64692 for GIF scaling fixes
Modified paths:
  • /branches/wmf/1.16wmf3/includes/DefaultSettings.php (modified) (history)
  • /branches/wmf/1.16wmf3/includes/media/Bitmap.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf3/includes/media/Bitmap.php
@@ -18,15 +18,6 @@
1919 $srcWidth = $image->getWidth( $params['page'] );
2020 $srcHeight = $image->getHeight( $params['page'] );
2121
22 - # Don't thumbnail an image so big that it will fill hard drives and send servers into swap
23 - # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
24 - # an exception for it.
25 - if ( $mimeType !== 'image/jpeg' &&
26 - $this->getImageArea( $image, $srcWidth, $srcHeight ) > $wgMaxImageArea )
27 - {
28 - return false;
29 - }
30 -
3122 # Don't make an image bigger than the source
3223 $params['physicalWidth'] = $params['width'];
3324 $params['physicalHeight'] = $params['height'];
@@ -34,9 +25,20 @@
3526 if ( $params['physicalWidth'] >= $srcWidth ) {
3627 $params['physicalWidth'] = $srcWidth;
3728 $params['physicalHeight'] = $srcHeight;
38 - return true;
 29+ # Skip scaling limit checks if no scaling is required
 30+ if( !$image->mustRender() )
 31+ return true;
3932 }
4033
 34+ # Don't thumbnail an image so big that it will fill hard drives and send servers into swap
 35+ # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
 36+ # an exception for it.
 37+ if ( $mimeType !== 'image/jpeg' &&
 38+ $srcWidth * $srcHeight > $wgMaxImageArea )
 39+ {
 40+ return false;
 41+ }
 42+
4143 return true;
4244 }
4345
@@ -121,7 +123,7 @@
122124 } elseif ( $mimeType == 'image/png' ) {
123125 $quality = "-quality 95"; // zlib 9, adaptive filtering
124126 } elseif( $mimeType == 'image/gif' ) {
125 - if( $srcWidth * $srcHeight > $wgMaxAnimatedGifArea ) {
 127+ if( $this->getImageArea( $image, $srcWidth, $srcHeight ) > $wgMaxAnimatedGifArea ) {
126128 // Extract initial frame only; we're so big it'll
127129 // be a total drag. :P
128130 $frame = '[0]';
Property changes on: branches/wmf/1.16wmf3/includes/media/Bitmap.php
___________________________________________________________________
Name: svn:mergeinfo
129131 + /branches/REL1_15/phase3/includes/media/Bitmap.php:51646
/branches/wmf-deployment/includes/media/Bitmap.php:53381
/trunk/phase3/includes/media/Bitmap.php:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57530,57541,57602,57916,58151,58219,58633,58816,59718,60704,60760,61189,61557,64691-64692
Index: branches/wmf/1.16wmf3/includes/DefaultSettings.php
@@ -2249,11 +2249,11 @@
22502250 $wgMaxImageArea = 1.25e7;
22512251 /**
22522252 * Force thumbnailing of animated GIFs above this size to a single
2253 - * frame instead of an animated thumbnail. ImageMagick seems to
2254 - * get real unhappy and doesn't play well with resource limits. :P
2255 - * Defaulting to 1 megapixel (1000x1000)
 2253+ * frame instead of an animated thumbnail. As of MW 1.17 this limit
 2254+ * is checked against the total size of all frames in the animation.
 2255+ * It probably makes sense to keep this equal to $wgMaxImageArea.
22562256 */
2257 -$wgMaxAnimatedGifArea = 1.0e6;
 2257+$wgMaxAnimatedGifArea = 1.25e7;
22582258 /**
22592259 * Browsers don't support TIFF inline generally...
22602260 * For inline display, we need to convert to PNG or JPEG.
Property changes on: branches/wmf/1.16wmf3/includes/DefaultSettings.php
___________________________________________________________________
Name: svn:mergeinfo
22612261 - /branches/REL1_15/phase3/includes/DefaultSettings.php:51646
/branches/wmf-deployment/includes/DefaultSettings.php:53381
/trunk/phase3/includes/DefaultSettings.php:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57530,57541,57602,57916,58151,58219,58633,58816,59607,59680,59683,60704,61557,62486
22622262 + /branches/REL1_15/phase3/includes/DefaultSettings.php:51646
/branches/wmf-deployment/includes/DefaultSettings.php:53381
/trunk/phase3/includes/DefaultSettings.php:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57530,57541,57602,57916,58151,58219,58633,58816,59607,59680,59683,60704,61557,62486,64692

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
r64692(bug 23063) Reverse handling of $wgMaxImageArea and $wgMaxAnimatedGifArea: th...vyznev05:41, 7 April 2010

Status & tagging log