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

Revision: 93750
Author:   brion
Date:     2011-08-02 14:22:32 +0000 (Tue, 02 Aug 2011)
Log Message:
-----------
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/wmf/1.17wmf1/includes/media/SVG.php

Modified: branches/wmf/1.17wmf1/includes/media/SVG.php
===================================================================
--- branches/wmf/1.17wmf1/includes/media/SVG.php        2011-08-02 14:17:19 UTC 
(rev 93749)
+++ branches/wmf/1.17wmf1/includes/media/SVG.php        2011-08-02 14:22:32 UTC 
(rev 93750)
@@ -49,14 +49,23 @@
                if ( !parent::normaliseParams( $image, $params ) ) {
                        return false;
                }
-               # Don't make an image bigger than wgMaxSVGSize
+               # Don't make an image bigger than wgMaxSVGSize on the smaller 
side
                $params['physicalWidth'] = $params['width'];
                $params['physicalHeight'] = $params['height'];
-               if ( $params['physicalWidth'] > $wgSVGMaxSize ) {
-                       $srcWidth = $image->getWidth( $params['page'] );
-                       $srcHeight = $image->getHeight( $params['page'] );
-                       $params['physicalWidth'] = $wgSVGMaxSize;
-                       $params['physicalHeight'] = File::scaleHeight( 
$srcWidth, $srcHeight, $wgSVGMaxSize );
+               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