http://www.mediawiki.org/wiki/Special:Code/MediaWiki/93746

Revision: 93746
Author:   brion
Date:     2011-08-02 14:13:51 +0000 (Tue, 02 Aug 2011)
Log Message:
-----------
* $wgSVGMaxSize is now applied to the smaller of width or height, making very 
wide pano/timeline/diagram SVGs renderable at saner sizes

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES-1.18
    trunk/phase3/includes/media/SVG.php

Modified: trunk/phase3/RELEASE-NOTES-1.18
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.18     2011-08-02 14:08:39 UTC (rev 93745)
+++ trunk/phase3/RELEASE-NOTES-1.18     2011-08-02 14:13:51 UTC (rev 93746)
@@ -433,6 +433,7 @@
   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.

Modified: trunk/phase3/includes/media/SVG.php
===================================================================
--- trunk/phase3/includes/media/SVG.php 2011-08-02 14:08:39 UTC (rev 93745)
+++ trunk/phase3/includes/media/SVG.php 2011-08-02 14:13:51 UTC (rev 93746)
@@ -58,12 +58,21 @@
                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;
        }


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to