r93749 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93748‎ | r93749 | r93750 >
Date:14:17, 2 August 2011
Author:brion
Status:ok
Tags:
Comment:
MFT r93746 -- change $wgSVGMaxSize handling to be nicer to images that are very wide but not very tall; apply the limit to the shorter side.
Modified paths:
  • /branches/REL1_17/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_17/phase3/includes/media/SVG.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/includes/media/SVG.php
@@ -49,14 +49,23 @@
5050 if ( !parent::normaliseParams( $image, $params ) ) {
5151 return false;
5252 }
53 - # Don't make an image bigger than wgMaxSVGSize
 53+ # Don't make an image bigger than wgMaxSVGSize on the smaller side
5454 $params['physicalWidth'] = $params['width'];
5555 $params['physicalHeight'] = $params['height'];
56 - if ( $params['physicalWidth'] > $wgSVGMaxSize ) {
57 - $srcWidth = $image->getWidth( $params['page'] );
58 - $srcHeight = $image->getHeight( $params['page'] );
59 - $params['physicalWidth'] = $wgSVGMaxSize;
60 - $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize );
 56+ if ( $params['physicalWidth'] <= $params['physicalHeight'] ) {
 57+ if ( $params['physicalWidth'] > $wgSVGMaxSize ) {
 58+ $srcWidth = $image->getWidth( $params['page'] );
 59+ $srcHeight = $image->getHeight( $params['page'] );
 60+ $params['physicalWidth'] = $wgSVGMaxSize;
 61+ $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize );
 62+ }
 63+ } else {
 64+ if ( $params['physicalHeight'] > $wgSVGMaxSize ) {
 65+ $srcWidth = $image->getWidth( $params['page'] );
 66+ $srcHeight = $image->getHeight( $params['page'] );
 67+ $params['physicalWidth'] = File::scaleHeight( $srcHeight, $srcWidth, $wgSVGMaxSize );
 68+ $params['physicalHeight'] = $wgSVGMaxSize;
 69+ }
6170 }
6271 return true;
6372 }
Index: branches/REL1_17/phase3/RELEASE-NOTES
@@ -50,6 +50,8 @@
5151 title is given, instead of a URL.
5252 * (bug 19514) Unordered list list-style-image should be IE6-compatible (8-bit).
5353 * Installer checked for magic_quotes_runtime instead of register_globals.
 54+* $wgSVGMaxSize is now applied to the smaller of width or height, making very
 55+ wide pano/timeline/diagram SVGs renderable at saner sizes
5456
5557 === Changes since 1.17.0rc1 ===
5658

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93746* $wgSVGMaxSize is now applied to the smaller of width or height, making very...brion14:13, 2 August 2011

Status & tagging log