User "Bawolff" posted a comment on MediaWiki.r92279.
Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/92279#c22198
Commit summary:
(bug 28762) Resizing to specified height broken for very thin images
Restructure and comment of ImageHandler::normaliseParams().
ImageHandler::normaliseParams() will now output both width/height as
physicalWidth/Height, where width/height are the dimensions used by the
browser, and physicalWidth/Height are the dimensions of the thumbnail that will
be created. This allows keeping the use of unique dimensions for a specified
thumbnail width, by forcing client side resizing of 1px-wide images with non
corresponding height.
Also fixed a bug where the check for mustRender() was in an if statement where
it should not have been.
Comment:
<pre>
+ # 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'] );
</pre>
Isn't the exact same thing done as a side effect of
<code>validateThumbParams</code> a couple lines down?
<pre>
- # Skip scaling limit checks if no scaling is required
- if ( !$image->mustRender() )
- return true;
}
+
+ # Skip scaling limit checks if no scaling is required
+ if ( !$image->mustRender() )
+ return true;
</pre>
I think this was correct before. We only want to skip the scaling checks if we
don't have to render the image, thus we should return true only if we don't
have to downscale image and rendering the image isn't required. (Otherwise
people could request way too big png thumbnails for example)
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview