Allow skipping $wgMaxImageArea check
If $wgMaxImageArea is false, MediaWiki will no longer check if the image fits within that area before trying to scale it. Extensions can still use the BitmapHandlerCheckImageArea hook to override it. This is primarily useful when using an external scaler like Wikimedia does with Thumbor, which decides whether it can scale images by using a timeout rather than based on size. Codesearch indicates that the only extension checking this setting is PagedTiffHandler, which will be updated in Iefa67321d07f7. Bug: T291014 Depends-On: Iefa67321d07f79d982388231e02e87e2f18aed40 Change-Id: Id10173bbddb32bc70e036f426369cfbea52cecf4
This commit is contained in:
parent
93e2497411
commit
a7c90ecc5f
3 changed files with 14 additions and 0 deletions
|
|
@ -27,6 +27,9 @@ of automatic detection of possible phone numbers in a webpage in Safari on iOS.
|
|||
* …
|
||||
|
||||
==== Changed configuration ====
|
||||
* $wgMaxImageArea - This setting may now be set to false to disable size
|
||||
checking before scaling. Extensions can still override its value by
|
||||
using the BitmapHandlerCheckImageArea hook.
|
||||
* …
|
||||
|
||||
==== Removed configuration ====
|
||||
|
|
|
|||
|
|
@ -1403,8 +1403,14 @@ $wgMediaInTargetLanguage = true;
|
|||
* built-in image scalers, such as ImageMagick or GD. It is ignored for
|
||||
* JPEGs with ImageMagick, and when using the VipsScaler extension.
|
||||
*
|
||||
* If set to false, MediaWiki will not check the size of the image before
|
||||
* attempting to scale it. Extensions may still override this setting by
|
||||
* using the BitmapHandlerCheckImageArea hook.
|
||||
*
|
||||
* The default is 50 MB if decompressed to RGBA form, which corresponds to
|
||||
* 12.5 million pixels or 3500x3500.
|
||||
*
|
||||
* @var string|bool
|
||||
*/
|
||||
$wgMaxImageArea = 1.25e7;
|
||||
|
||||
|
|
|
|||
|
|
@ -620,6 +620,11 @@ abstract class TransformationalImageHandler extends ImageHandler {
|
|||
return (bool)$checkImageAreaHookResult;
|
||||
}
|
||||
|
||||
if ( $wgMaxImageArea === false ) {
|
||||
// Checking is disabled, fine to thumbnail
|
||||
return true;
|
||||
}
|
||||
|
||||
$srcWidth = $file->getWidth( $params['page'] );
|
||||
$srcHeight = $file->getHeight( $params['page'] );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue