r64691 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64690‎ | r64691 | r64692 >
Date:05:17, 7 April 2010
Author:vyznev
Status:ok (Comments)
Tags:
Comment:
allow display of unscaled image even if it exceeds $wgMaxImageArea (this can happen with animated GIFs, see bug 23063)
Modified paths:
  • /trunk/phase3/includes/media/Bitmap.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/media/Bitmap.php
@@ -18,6 +18,18 @@
1919 $srcWidth = $image->getWidth( $params['page'] );
2020 $srcHeight = $image->getHeight( $params['page'] );
2121
 22+ # Don't make an image bigger than the source
 23+ $params['physicalWidth'] = $params['width'];
 24+ $params['physicalHeight'] = $params['height'];
 25+
 26+ if ( $params['physicalWidth'] >= $srcWidth ) {
 27+ $params['physicalWidth'] = $srcWidth;
 28+ $params['physicalHeight'] = $srcHeight;
 29+ # Skip scaling limit checks if no scaling is required
 30+ if( !$image->mustRender() )
 31+ return true;
 32+ }
 33+
2234 # Don't thumbnail an image so big that it will fill hard drives and send servers into swap
2335 # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
2436 # an exception for it.
@@ -27,16 +39,6 @@
2840 return false;
2941 }
3042
31 - # Don't make an image bigger than the source
32 - $params['physicalWidth'] = $params['width'];
33 - $params['physicalHeight'] = $params['height'];
34 -
35 - if ( $params['physicalWidth'] >= $srcWidth ) {
36 - $params['physicalWidth'] = $srcWidth;
37 - $params['physicalHeight'] = $srcHeight;
38 - return true;
39 - }
40 -
4143 return true;
4244 }
4345

Follow-up revisions

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

Comments

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

Looks okay, I'm going to deploy this.

Status & tagging log