Jump to content

Wikia code/includes/media/Bitmap.php

From mediawiki.org
--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\media\Bitmap.php	2011-07-18 22:31:07.714843800 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\media\Bitmap.php	2011-08-17 15:28:14.600585900 +0100
@@ -9,7 +9,7 @@
  */
 class BitmapHandler extends ImageHandler {
 	function normaliseParams( $image, &$params ) {
-		global $wgMaxImageArea;
+		global $wgMaxImageArea, $wgMaxThumbnailArea;
 		if ( !parent::normaliseParams( $image, $params ) ) {
 			return false;
 		}
@@ -34,7 +34,13 @@
 		if ( $params['physicalWidth'] >= $srcWidth ) {
 			$params['physicalWidth'] = $srcWidth;
 			$params['physicalHeight'] = $srcHeight;
-			return true;
+		}
+
+		# Same as srcWidth * srcHeight above but:
+		# - no free pass for jpeg
+		# - thumbs should be smaller
+		if ( $params['physicalWidth'] * $params['physicalHeight'] > $wgMaxThumbnailArea ) {
+			return false;
 		}
 
 		return true;