From: Brion Vibber Date: Tue, 2 Aug 2011 14:13:51 +0000 (+0000) Subject: * $wgSVGMaxSize is now applied to the smaller of width or height, making very wide... X-Git-Tag: 1.31.0-rc.0~28489 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=903f36ea065a693eb37e49fe35160322c60904b3;p=lhc%2Fweb%2Fwiklou.git * $wgSVGMaxSize is now applied to the smaller of width or height, making very wide pano/timeline/diagram SVGs renderable at saner sizes --- diff --git a/RELEASE-NOTES-1.18 b/RELEASE-NOTES-1.18 index f7dfabaac0..16d9f1b085 100644 --- a/RELEASE-NOTES-1.18 +++ b/RELEASE-NOTES-1.18 @@ -433,6 +433,7 @@ production. param is only present in hash. * Installer checked for magic_quotes_runtime instead of register_globals. * (bug 30131) XCache with variable caching disabled no longer used for variable caching (CACHE_ACCEL) +* $wgSVGMaxSize is now applied to the smaller of width or height, making very wide pano/timeline/diagram SVGs renderable at saner sizes === API changes in 1.18 === * BREAKING CHANGE: action=watch now requires POST and token. diff --git a/includes/media/SVG.php b/includes/media/SVG.php index bb2d47dca0..9a32cf6e17 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -58,12 +58,21 @@ class SvgHandler extends ImageHandler { if ( !parent::normaliseParams( $image, $params ) ) { return false; } - # Don't make an image bigger than wgMaxSVGSize - if ( $params['physicalWidth'] > $wgSVGMaxSize ) { - $srcWidth = $image->getWidth( $params['page'] ); - $srcHeight = $image->getHeight( $params['page'] ); - $params['physicalWidth'] = $wgSVGMaxSize; - $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize ); + # Don't make an image bigger than wgMaxSVGSize on the smaller side + if ( $params['physicalWidth'] <= $params['physicalHeight'] ) { + if ( $params['physicalWidth'] > $wgSVGMaxSize ) { + $srcWidth = $image->getWidth( $params['page'] ); + $srcHeight = $image->getHeight( $params['page'] ); + $params['physicalWidth'] = $wgSVGMaxSize; + $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize ); + } + } else { + if ( $params['physicalHeight'] > $wgSVGMaxSize ) { + $srcWidth = $image->getWidth( $params['page'] ); + $srcHeight = $image->getHeight( $params['page'] ); + $params['physicalWidth'] = File::scaleHeight( $srcHeight, $srcWidth, $wgSVGMaxSize ); + $params['physicalHeight'] = $wgSVGMaxSize; + } } return true; }