* (bug 27132) movefile right granted by default to registered users.
* Default cookie lifetime ($wgCookieExpiration) is increased to 180 days.
* (bug 31204) Removed old user.user_options
+* $wgMaxImageArea now applies to jpeg files if they are not scaled with
+ ImageMagick.
=== New features in 1.19 ===
* (bug 19838) Possibility to get all interwiki prefixes if the interwiki
* @return bool
*/
function normaliseParams( $image, &$params ) {
- global $wgMaxImageArea;
+
if ( !parent::normaliseParams( $image, $params ) ) {
return false;
}
return true;
}
}
-
+
+ return true;
+ }
+
+ /**
+ * Check if the file is smaller than the maximum image area for
+ * thumbnailing. Check will always pass if the scaler is 'hookaborted' or
+ * if the scaler is 'im' and the mime type is 'image/jpeg'
+ *
+ * @param File $image
+ * @param string $scaler
+ */
+ function checkImageArea( $image, $scaler ) {
+ global $wgMaxImageArea;
# 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.
- # @todo FIXME: This actually only applies to ImageMagick
- if ( $mimeType !== 'image/jpeg' &&
- $srcWidth * $srcHeight > $wgMaxImageArea )
+
+
+ if ( $image->getMimeType() == 'image/jpeg' && $scaler == 'im' )
{
- return false;
+ # ImageMagick can efficiently downsize jpg images without loading
+ # the entire file in memory
+ return true;
}
-
- return true;
+
+ if ( $scaler == 'hookaborted' )
+ {
+ # If a hook wants to transform the image, it is responsible for
+ # checking the image size, so abort here
+ return true;
+ }
+
+ # Do the actual check
+ return $this->getImageArea( $image, $image->getWidth(), $image->getHeight() ) <= $wgMaxImageArea;
}
+
/**
* Extracts the width/height if the image will be scaled before rotating
*
wfDebug( __METHOD__ . ": Hook to BitmapHandlerTransform created an mto\n" );
$scaler = 'hookaborted';
}
+
+ # Check max image area
+ if ( !$this->checkImageArea( $image, $scaler ) )
+ {
+ return new TransformParameterError( $params );
+ }
switch ( $scaler ) {
case 'hookaborted':