2012-07-23 18:59:38 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Media-handling base classes and generic functionality.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup Media
|
|
|
|
|
*/
|
|
|
|
|
|
2022-02-24 20:17:53 +00:00
|
|
|
use Wikimedia\AtEase\AtEase;
|
|
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
/**
|
|
|
|
|
* Media handler abstract base class for images
|
|
|
|
|
*
|
2020-07-13 09:00:30 +00:00
|
|
|
* @stable to extend
|
2020-07-01 19:15:09 +00:00
|
|
|
*
|
2012-07-23 18:59:38 +00:00
|
|
|
* @ingroup Media
|
|
|
|
|
*/
|
|
|
|
|
abstract class ImageHandler extends MediaHandler {
|
|
|
|
|
/**
|
2020-07-01 19:15:09 +00:00
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2013-12-05 19:27:27 +00:00
|
|
|
* @param File $file
|
2012-07-23 18:59:38 +00:00
|
|
|
* @return bool
|
|
|
|
|
*/
|
2016-02-23 23:47:02 +00:00
|
|
|
public function canRender( $file ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
return ( $file->getWidth() && $file->getHeight() );
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-01 19:15:09 +00:00
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2020-07-01 19:15:09 +00:00
|
|
|
* @return string[]
|
|
|
|
|
*/
|
2016-02-23 23:47:02 +00:00
|
|
|
public function getParamMap() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [ 'img_width' => 'width' ];
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
2020-07-01 19:15:09 +00:00
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2020-07-01 19:15:09 +00:00
|
|
|
*/
|
2016-02-23 23:47:02 +00:00
|
|
|
public function validateParam( $name, $value ) {
|
2021-08-17 21:15:57 +00:00
|
|
|
return in_array( $name, [ 'width', 'height' ] ) && $value > 0;
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
2020-07-01 19:15:09 +00:00
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2023-06-09 16:14:32 +00:00
|
|
|
* @throws MediaTransformInvalidParametersException
|
2020-07-01 19:15:09 +00:00
|
|
|
*/
|
2016-02-23 23:47:02 +00:00
|
|
|
public function makeParamString( $params ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
if ( isset( $params['physicalWidth'] ) ) {
|
|
|
|
|
$width = $params['physicalWidth'];
|
|
|
|
|
} elseif ( isset( $params['width'] ) ) {
|
|
|
|
|
$width = $params['width'];
|
|
|
|
|
} else {
|
2015-02-05 02:16:06 +00:00
|
|
|
throw new MediaTransformInvalidParametersException( 'No width specified to ' . __METHOD__ );
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
2013-12-05 10:05:05 +00:00
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
# Removed for ProofreadPage
|
2015-09-11 13:44:59 +00:00
|
|
|
# $width = intval( $width );
|
2012-07-23 18:59:38 +00:00
|
|
|
return "{$width}px";
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-01 19:15:09 +00:00
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2020-07-01 19:15:09 +00:00
|
|
|
*/
|
2016-02-23 23:47:02 +00:00
|
|
|
public function parseParamString( $str ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
$m = false;
|
|
|
|
|
if ( preg_match( '/^(\d+)px$/', $str, $m ) ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [ 'width' => $m[1] ];
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
2023-03-08 20:44:20 +00:00
|
|
|
return false;
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
2020-07-01 19:15:09 +00:00
|
|
|
/**
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2023-03-24 02:48:54 +00:00
|
|
|
* @param array $params
|
|
|
|
|
* @return array
|
2020-07-01 19:15:09 +00:00
|
|
|
*/
|
2019-02-25 09:20:28 +00:00
|
|
|
protected function getScriptParams( $params ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [ 'width' => $params['width'] ];
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-07-01 19:15:09 +00:00
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2013-12-05 19:27:27 +00:00
|
|
|
* @param File $image
|
2022-04-02 19:15:16 +00:00
|
|
|
* @param array &$params @phan-ignore-reference
|
2012-07-23 18:59:38 +00:00
|
|
|
* @return bool
|
2022-04-02 19:15:16 +00:00
|
|
|
* @phan-assert array{width:int,physicalWidth:int,height:int,physicalHeight:int,page:int} $params
|
2012-07-23 18:59:38 +00:00
|
|
|
*/
|
2018-10-06 00:56:53 +00:00
|
|
|
public function normaliseParams( $image, &$params ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
if ( !isset( $params['width'] ) ) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !isset( $params['page'] ) ) {
|
|
|
|
|
$params['page'] = 1;
|
2013-04-20 21:11:46 +00:00
|
|
|
} else {
|
2023-03-08 20:44:20 +00:00
|
|
|
$params['page'] = (int)$params['page'];
|
2012-07-23 18:59:38 +00:00
|
|
|
if ( $params['page'] > $image->pageCount() ) {
|
|
|
|
|
$params['page'] = $image->pageCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $params['page'] < 1 ) {
|
|
|
|
|
$params['page'] = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$srcWidth = $image->getWidth( $params['page'] );
|
|
|
|
|
$srcHeight = $image->getHeight( $params['page'] );
|
|
|
|
|
|
2023-03-08 20:44:20 +00:00
|
|
|
if ( isset( $params['height'] ) && $params['height'] !== -1 ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
# Height & width were both set
|
|
|
|
|
if ( $params['width'] * $srcHeight > $params['height'] * $srcWidth ) {
|
|
|
|
|
# Height is the relative smaller dimension, so scale width accordingly
|
|
|
|
|
$params['width'] = self::fitBoxWidth( $srcWidth, $srcHeight, $params['height'] );
|
|
|
|
|
|
|
|
|
|
if ( $params['width'] == 0 ) {
|
|
|
|
|
# Very small image, so we need to rely on client side scaling :(
|
|
|
|
|
$params['width'] = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$params['physicalWidth'] = $params['width'];
|
|
|
|
|
} else {
|
|
|
|
|
# Height was crap, unset it so that it will be calculated later
|
|
|
|
|
unset( $params['height'] );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !isset( $params['physicalWidth'] ) ) {
|
|
|
|
|
# Passed all validations, so set the physicalWidth
|
2022-04-02 19:15:16 +00:00
|
|
|
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset False positive, checked above
|
2012-07-23 18:59:38 +00:00
|
|
|
$params['physicalWidth'] = $params['width'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Because thumbs are only referred to by width, the height always needs
|
|
|
|
|
# to be scaled by the width to keep the thumbnail sizes consistent,
|
|
|
|
|
# even if it was set inside the if block above
|
|
|
|
|
$params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight,
|
|
|
|
|
$params['physicalWidth'] );
|
|
|
|
|
|
|
|
|
|
# Set the height if it was not validated in the if block higher up
|
2023-03-08 20:44:20 +00:00
|
|
|
if ( !isset( $params['height'] ) || $params['height'] === -1 ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
$params['height'] = $params['physicalHeight'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !$this->validateThumbParams( $params['physicalWidth'],
|
2023-02-05 19:21:50 +00:00
|
|
|
$params['physicalHeight'], $srcWidth, $srcHeight )
|
2013-12-05 10:05:05 +00:00
|
|
|
) {
|
2012-07-23 18:59:38 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
2013-12-05 10:05:05 +00:00
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Validate thumbnail parameters and fill in the correct height
|
|
|
|
|
*
|
2017-08-11 00:23:16 +00:00
|
|
|
* @param int &$width Specified width (input/output)
|
|
|
|
|
* @param int &$height Height (output only)
|
2013-12-05 19:27:27 +00:00
|
|
|
* @param int $srcWidth Width of the source image
|
|
|
|
|
* @param int $srcHeight Height of the source image
|
2012-07-23 18:59:38 +00:00
|
|
|
* @return bool False to indicate that an error should be returned to the user.
|
|
|
|
|
*/
|
2023-02-05 19:21:50 +00:00
|
|
|
private function validateThumbParams( &$width, &$height, $srcWidth, $srcHeight ) {
|
2023-03-08 20:44:20 +00:00
|
|
|
$width = (int)$width;
|
2012-07-23 18:59:38 +00:00
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( $width <= 0 ) {
|
2020-06-01 05:00:39 +00:00
|
|
|
wfDebug( __METHOD__ . ": Invalid destination width: $width" );
|
2013-12-05 10:05:05 +00:00
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if ( $srcWidth <= 0 ) {
|
2020-06-01 05:00:39 +00:00
|
|
|
wfDebug( __METHOD__ . ": Invalid source width: $srcWidth" );
|
2013-12-05 10:05:05 +00:00
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$height = File::scaleHeight( $srcWidth, $srcHeight, $width );
|
|
|
|
|
if ( $height == 0 ) {
|
|
|
|
|
# Force height to be at least 1 pixel
|
|
|
|
|
$height = 1;
|
|
|
|
|
}
|
2013-12-05 10:05:05 +00:00
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-07-01 19:15:09 +00:00
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2013-12-05 19:27:27 +00:00
|
|
|
* @param File $image
|
|
|
|
|
* @param string $script
|
|
|
|
|
* @param array $params
|
2022-03-28 20:55:34 +00:00
|
|
|
* @return MediaTransformOutput|false
|
2012-07-23 18:59:38 +00:00
|
|
|
*/
|
2020-05-17 23:57:36 +00:00
|
|
|
public function getScriptedTransform( $image, $script, $params ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
if ( !$this->normaliseParams( $image, $params ) ) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-04-11 18:22:11 +00:00
|
|
|
$url = wfAppendQuery( $script, $this->getScriptParams( $params ) );
|
2012-07-23 18:59:38 +00:00
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( $image->mustRender() || $params['width'] < $image->getWidth() ) {
|
2012-09-01 16:12:48 +00:00
|
|
|
return new ThumbnailImage( $image, $url, false, $params );
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-17 23:57:36 +00:00
|
|
|
public function getImageSize( $image, $path ) {
|
2022-02-24 20:17:53 +00:00
|
|
|
AtEase::suppressWarnings();
|
2012-07-23 18:59:38 +00:00
|
|
|
$gis = getimagesize( $path );
|
2022-02-24 20:17:53 +00:00
|
|
|
AtEase::restoreWarnings();
|
2013-12-05 10:05:05 +00:00
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
return $gis;
|
|
|
|
|
}
|
2013-12-05 10:05:05 +00:00
|
|
|
|
Use the unserialized form of image metadata internally
Image metadata is usually a serialized string representing an array.
Passing the string around internally and having everything unserialize
it is an awkward convention.
Also, many image handlers were reading the file twice: once for
getMetadata() and again for getImageSize(). Often getMetadata()
would actually read the width and height and then throw it away.
So, in filerepo:
* Add File::getMetadataItem(), which promises to allow partial
loading of metadata per my proposal on T275268 in a future commit.
* Add File::getMetadataArray(), which returns the unserialized array.
Some file handlers were returning non-serializable strings from
getMetadata(), so I gave them a legacy array form ['_error' => ...]
* Changed MWFileProps to return the array form of metadata.
* Deprecate the weird File::getImageSize(). It was apparently not
called by anything, but was overridden by UnregisteredLocalFile.
* Wrap serialize/unserialize with File::getMetadataForDb() and
File::loadMetadataFromDb() in preparation for T275268.
In MediaHandler:
* Merged MediaHandler::getImageSize() and MediaHandler::getMetadata()
into getSizeAndMetadata(). Deprecated the old methods.
* Instead of isMetadataValid() we now have isFileMetadataValid(), which
only gets a File object, so it can decide what data it needs to load.
* Simplified getPageDimensions() by having it return false for non-paged
media. It was not called in that case, but was implemented anyway.
In specific handlers:
* Rename DjVuHandler::getUnserializedMetadata() and
extractTreesFromMetadata() for clarity. "Metadata" in these function
names meant an XML string.
* Updated DjVuImage::getImageSize() to provide image sizes in the new
style.
* In ExifBitmapHandler, getRotationForExif() now takes just the
Orientation tag, rather than a serialized string. Also renamed for
clarity.
* In GIFMetadataExtractor, return the width, height and bits per channel
instead of throwing them away. There was some conflation in
decodeBPP() which I picked apart. Refer to GIF89a section 18.
* In JpegMetadataExtractor, process the SOF0/SOF2 segment to extract
bits per channel, width, height and components (channel count). This
is essentially a port of PHP's getimagesize(), so should be bugwards
compatible.
* In PNGMetadataExtractor, return the width and height, which were
previously assigned to unused local variables. I verified the
implementation by referring to the specification.
* In SvgHandler, retain the version validation from unpackMetadata(),
but rename the function since it now takes an array as input.
In tests:
* In ExifBitmapTest, refactored some tests by using a provider.
* In GIFHandlerTest and PNGHandlerTest, I removed the tests in which
getMetadata() returns null, since it doesn't make sense when ported to
getMetadataArray(). I added tests for empty arrays instead.
* In tests, I retained serialization of input data since I figure it's
useful to confirm that existing database rows will continue to be read
correctly. I removed serialization of expected values, replacing them
with plain data.
* In tests, I replaced access to private class constants like
BROKEN_FILE with string literals, since stability is essential. If
the class constant changes, the test should fail.
Elsewhere:
* In maintenance/refreshImageMetadata.php, I removed the check for
shrinking image metadata, since it's not easy to implement and is
not future compatible. Image metadata is expected to shrink in
future.
Bug: T275268
Change-Id: I039785d5b6439d71dcc21dcb972177dba5c3a67d
2021-05-19 00:24:32 +00:00
|
|
|
public function getSizeAndMetadata( $state, $path ) {
|
|
|
|
|
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
|
|
|
|
|
$gis = @getimagesize( $path );
|
|
|
|
|
if ( $gis ) {
|
|
|
|
|
$info = [
|
|
|
|
|
'width' => $gis[0],
|
|
|
|
|
'height' => $gis[1],
|
|
|
|
|
];
|
|
|
|
|
if ( isset( $gis['bits'] ) ) {
|
|
|
|
|
$info['bits'] = $gis['bits'];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$info = [];
|
|
|
|
|
}
|
|
|
|
|
return $info;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-29 02:12:58 +00:00
|
|
|
/**
|
|
|
|
|
* Function that returns the number of pixels to be thumbnailed.
|
|
|
|
|
* Intended for animated GIFs to multiply by the number of frames.
|
|
|
|
|
*
|
|
|
|
|
* If the file doesn't support a notion of "area" return 0.
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2013-09-29 02:12:58 +00:00
|
|
|
*
|
|
|
|
|
* @param File $image
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
2020-05-17 23:57:36 +00:00
|
|
|
public function getImageArea( $image ) {
|
2013-09-29 02:12:58 +00:00
|
|
|
return $image->getWidth() * $image->getHeight();
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
/**
|
2020-07-01 19:15:09 +00:00
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2013-12-05 19:27:27 +00:00
|
|
|
* @param File $file
|
2012-07-23 18:59:38 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2020-05-17 23:57:36 +00:00
|
|
|
public function getShortDesc( $file ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
global $wgLang;
|
|
|
|
|
$nbytes = htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
|
2013-12-05 11:33:18 +00:00
|
|
|
$widthheight = wfMessage( 'widthheight' )
|
|
|
|
|
->numParams( $file->getWidth(), $file->getHeight() )->escaped();
|
2012-07-23 18:59:38 +00:00
|
|
|
|
|
|
|
|
return "$widthheight ($nbytes)";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-07-01 19:15:09 +00:00
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2013-12-05 19:27:27 +00:00
|
|
|
* @param File $file
|
2012-07-23 18:59:38 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2019-02-25 09:16:30 +00:00
|
|
|
public function getLongDesc( $file ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
$pages = $file->pageCount();
|
|
|
|
|
if ( $pages === false || $pages <= 1 ) {
|
|
|
|
|
$msg = wfMessage( 'file-info-size' )->numParams( $file->getWidth(),
|
2021-09-20 22:35:30 +00:00
|
|
|
$file->getHeight() )->sizeParams( $file->getSize() )->params(
|
2015-03-05 18:52:11 +00:00
|
|
|
'<span class="mime-type">' . $file->getMimeType() . '</span>' )->parse();
|
2012-07-23 18:59:38 +00:00
|
|
|
} else {
|
|
|
|
|
$msg = wfMessage( 'file-info-size-pages' )->numParams( $file->getWidth(),
|
2021-09-20 22:35:30 +00:00
|
|
|
$file->getHeight() )->sizeParams( $file->getSize() )->params(
|
2015-03-05 18:52:11 +00:00
|
|
|
'<span class="mime-type">' . $file->getMimeType() . '</span>' )->numParams( $pages )->parse();
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
2013-12-05 10:05:05 +00:00
|
|
|
|
2012-07-23 18:59:38 +00:00
|
|
|
return $msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-07-01 19:15:09 +00:00
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2013-12-05 19:27:27 +00:00
|
|
|
* @param File $file
|
2012-07-23 18:59:38 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2020-05-17 23:57:36 +00:00
|
|
|
public function getDimensionsString( $file ) {
|
2012-07-23 18:59:38 +00:00
|
|
|
$pages = $file->pageCount();
|
|
|
|
|
if ( $pages > 1 ) {
|
2013-12-05 11:33:18 +00:00
|
|
|
return wfMessage( 'widthheightpage' )
|
|
|
|
|
->numParams( $file->getWidth(), $file->getHeight(), $pages )->text();
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
2023-03-08 20:44:20 +00:00
|
|
|
return wfMessage( 'widthheight' )
|
|
|
|
|
->numParams( $file->getWidth(), $file->getHeight() )->text();
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|
2014-06-03 16:09:30 +00:00
|
|
|
|
2020-07-01 19:15:09 +00:00
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
2020-07-13 08:57:12 +00:00
|
|
|
* @stable to override
|
2020-07-01 19:15:09 +00:00
|
|
|
*/
|
2014-06-03 16:09:30 +00:00
|
|
|
public function sanitizeParamsForBucketing( $params ) {
|
|
|
|
|
$params = parent::sanitizeParamsForBucketing( $params );
|
|
|
|
|
|
|
|
|
|
// We unset the height parameters in order to let normaliseParams recalculate them
|
|
|
|
|
// Otherwise there might be a height discrepancy
|
2020-11-10 15:52:14 +00:00
|
|
|
unset( $params['height'] );
|
|
|
|
|
unset( $params['physicalHeight'] );
|
2014-06-03 16:09:30 +00:00
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
|
}
|
2012-07-23 18:59:38 +00:00
|
|
|
}
|