r64728 MediaWiki - Code Review archive

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

Diff [purge]

Index: branches/wmf/1.16wmf4/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
@@ -122,7 +124,7 @@
123125 } elseif ( $mimeType == 'image/png' ) {
124126 $quality = "-quality 95"; // zlib 9, adaptive filtering
125127 } elseif( $mimeType == 'image/gif' ) {
126 - if( $srcWidth * $srcHeight > $wgMaxAnimatedGifArea ) {
 128+ if( $this->getImageArea( $image, $srcWidth, $srcHeight ) > $wgMaxAnimatedGifArea ) {
127129 // Extract initial frame only; we're so big it'll
128130 // be a total drag. :P
129131 $frame = '[0]';
Property changes on: branches/wmf/1.16wmf4/includes/media/Bitmap.php
___________________________________________________________________
Name: svn:mergeinfo
130132 + /branches/REL1_15/phase3/includes/media/Bitmap.php:51646
/branches/sqlite/includes/media/Bitmap.php:58211-58321
/branches/wmf-deployment/includes/media/Bitmap.php:53381,60970
/trunk/phase3/includes/media/Bitmap.php:63549,63764,63897-63901,64691-64692
Index: branches/wmf/1.16wmf4/includes/DefaultSettings.php
@@ -2351,11 +2351,11 @@
23522352 $wgMaxImageArea = 1.25e7;
23532353 /**
23542354 * Force thumbnailing of animated GIFs above this size to a single
2355 - * frame instead of an animated thumbnail. ImageMagick seems to
2356 - * get real unhappy and doesn't play well with resource limits. :P
2357 - * Defaulting to 1 megapixel (1000x1000)
 2355+ * frame instead of an animated thumbnail. As of MW 1.17 this limit
 2356+ * is checked against the total size of all frames in the animation.
 2357+ * It probably makes sense to keep this equal to $wgMaxImageArea.
23582358 */
2359 -$wgMaxAnimatedGifArea = 1.0e6;
 2359+$wgMaxAnimatedGifArea = 1.25e7;
23602360 /**
23612361 * Browsers don't support TIFF inline generally...
23622362 * For inline display, we need to convert to PNG or JPEG.
Property changes on: branches/wmf/1.16wmf4/includes/DefaultSettings.php
___________________________________________________________________
Name: svn:mergeinfo
23632363 + /branches/REL1_15/phase3/includes/DefaultSettings.php:51646
/branches/sqlite/includes/DefaultSettings.php:58211-58321
/branches/wmf-deployment/includes/DefaultSettings.php:53381,60970
/trunk/phase3/includes/DefaultSettings.php:63549,63764,63897-63901,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