From daba9d916073aeba756e68f23ebc7488294763fd Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Wed, 7 Apr 2010 05:17:19 +0000 Subject: [PATCH] allow display of unscaled image even if it exceeds $wgMaxImageArea (this can happen with animated GIFs, see bug 23063) --- includes/media/Bitmap.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 016933b119..536797d296 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -18,15 +18,6 @@ class BitmapHandler extends ImageHandler { $srcWidth = $image->getWidth( $params['page'] ); $srcHeight = $image->getHeight( $params['page'] ); - # Don't thumbnail an image so big that it will fill hard drives and send servers into swap - # 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 ) - { - return false; - } - # Don't make an image bigger than the source $params['physicalWidth'] = $params['width']; $params['physicalHeight'] = $params['height']; @@ -34,7 +25,18 @@ class BitmapHandler extends ImageHandler { if ( $params['physicalWidth'] >= $srcWidth ) { $params['physicalWidth'] = $srcWidth; $params['physicalHeight'] = $srcHeight; - return true; + # Skip scaling limit checks if no scaling is required + if( !$image->mustRender() ) + return true; + } + + # Don't thumbnail an image so big that it will fill hard drives and send servers into swap + # 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 ) + { + return false; } return true; -- 2.20.1