r93747 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93746‎ | r93747 | r93748 >
Date:14:16, 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_18/phase3/RELEASE-NOTES-1.18 (modified) (history)
  • /branches/REL1_18/phase3/includes/media/SVG.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/RELEASE-NOTES-1.18
@@ -422,6 +422,7 @@
423423 tries to subsribe to mediawiki-announce
424424 * Installer checked for magic_quotes_runtime instead of register_globals.
425425 * (bug 30131) XCache with variable caching disabled no longer used for variable caching (CACHE_ACCEL)
 426+* $wgSVGMaxSize is now applied to the smaller of width or height, making very wide pano/timeline/diagram SVGs renderable at saner sizes
426427
427428 === API changes in 1.18 ===
428429 * BREAKING CHANGE: action=watch now requires POST and token.
Index: branches/REL1_18/phase3/includes/media/SVG.php
@@ -58,12 +58,21 @@
5959 if ( !parent::normaliseParams( $image, $params ) ) {
6060 return false;
6161 }
62 - # Don't make an image bigger than wgMaxSVGSize
63 - if ( $params['physicalWidth'] > $wgSVGMaxSize ) {
64 - $srcWidth = $image->getWidth( $params['page'] );
65 - $srcHeight = $image->getHeight( $params['page'] );
66 - $params['physicalWidth'] = $wgSVGMaxSize;
67 - $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize );
 62+ # Don't make an image bigger than wgMaxSVGSize on the smaller side
 63+ if ( $params['physicalWidth'] <= $params['physicalHeight'] ) {
 64+ if ( $params['physicalWidth'] > $wgSVGMaxSize ) {
 65+ $srcWidth = $image->getWidth( $params['page'] );
 66+ $srcHeight = $image->getHeight( $params['page'] );
 67+ $params['physicalWidth'] = $wgSVGMaxSize;
 68+ $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize );
 69+ }
 70+ } else {
 71+ if ( $params['physicalHeight'] > $wgSVGMaxSize ) {
 72+ $srcWidth = $image->getWidth( $params['page'] );
 73+ $srcHeight = $image->getHeight( $params['page'] );
 74+ $params['physicalWidth'] = File::scaleHeight( $srcHeight, $srcWidth, $wgSVGMaxSize );
 75+ $params['physicalHeight'] = $wgSVGMaxSize;
 76+ }
6877 }
6978 return true;
7079 }

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