Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2490
patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 8:58 PM
2014-11-21 20:58:29 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
patch
View Options
Index: includes/Linker.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Linker.php,v
retrieving revision 1.60
diff -u -r1.60 Linker.php
--- includes/Linker.php 6 Dec 2005 22:37:12 -0000 1.60
+++ includes/Linker.php 7 Dec 2005 19:55:25 -0000
@@ -430,16 +430,19 @@
if ( $manual_thumb == '') {
$thumb = $img->getThumbnail( $width, $height );
if ( $thumb ) {
- if( $width > $img->width && ( $height == -1 || $height > $img->height )) {
- // Requested a display size larger than the actual image;
- // fake it up!
- $height = round($thumb->height * $width / $thumb->width);
- wfDebug( "makeImageLinkObj: client-size height set to '$height'\n" );
- } else {
- $width = $thumb->width;
- $height = $thumb->height;
- wfDebug( "makeImageLinkObj: thumb height set to '$height'\n" );
+ // In most cases, $width = $thumb->width or $height = $thumb->height.
+ // If not, we're scaling the image larger than it can be scaled,
+ // so we send to the browser a smaller thumbnail, and let the client do the scaling.
+
+ if ($height != -1 && $width > $thumb->width * $height / $thumb->height) {
+ // $height is the limiting factor, not $width
+ // set $width to the largest it can be, such that the resulting
+ // scaled height is at most $height
+ $width = floor($thumb->width * $height / $thumb->height);
}
+ $height = round($thumb->height * $width / $thumb->width);
+
+ wfDebug( "makeImageLinkObj: client-size set to '$width x $height'\n" );
$url = $thumb->getUrl();
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2066
Default Alt Text
patch (1 KB)
Attached To
Mode
T6207: Wrong image size when using 100x200px syntax to scale image up
Attached
Detach File
Event Timeline
Log In to Comment