jenkins-bot has submitted this change and it was merged.
Change subject: Thumbnails generated from SVG may be larger than original
......................................................................
Thumbnails generated from SVG may be larger than original
Bug: T128278
Change-Id: I2b10ff28389fd9c99f0703d7ae4ee2d63e0bd000
---
M includes/ApiQueryPageImages.php
1 file changed, 6 insertions(+), 5 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/ApiQueryPageImages.php b/includes/ApiQueryPageImages.php
index e11ef88..ea28c11 100644
--- a/includes/ApiQueryPageImages.php
+++ b/includes/ApiQueryPageImages.php
@@ -146,13 +146,14 @@
if ( $file ) {
$thumb = $file->transform( array(
'width' => $size, 'height' => $size ) );
if ( $thumb && $thumb->getUrl() ) {
+ // You can request a thumb
1000x larger than the original
+ // which (in case of bitmap
original) will return a Thumb object
+ // that will lie about its size
but have the original as an image.
+ $reportedSize =
$thumb->fileIsSource() ? $file : $thumb;
$vals['thumbnail'] = array(
'source' =>
wfExpandUrl( $thumb->getUrl(), PROTO_CURRENT ),
- // You can request a
thumb 1000x larger than the original which will return a Thumb
- // object that will lie
about its size but have the original as an image.
- // Therefore, sanitize
image size.
- 'width' => min(
$thumb->getWidth(), $file->getWidth() ),
- 'height' => min(
$thumb->getHeight(), $file->getHeight() ),
+ 'width' =>
$reportedSize->getWidth(),
+ 'height' =>
$reportedSize->getHeight(),
);
}
}
--
To view, visit https://gerrit.wikimedia.org/r/273593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2b10ff28389fd9c99f0703d7ae4ee2d63e0bd000
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/PageImages
Gerrit-Branch: master
Gerrit-Owner: Petr.matas <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Petr.matas <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits