(bug 28940) When making a thumb of an SVG, and only specifying the height
authorBrian Wolff <bawolff@users.mediawiki.org>
Sat, 14 May 2011 23:48:59 +0000 (23:48 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Sat, 14 May 2011 23:48:59 +0000 (23:48 +0000)
make the width be the max SVG size, not the natrual width of the SVG.

Some of the linker code here should perhaps be moved. See comments on bug 28940

RELEASE-NOTES-1.19
includes/Linker.php

index 64afe59..436ccea 100644 (file)
@@ -44,6 +44,8 @@ used in Tiff files.
 * (bug 11868) If using links to count articles, the checking will now be based
   on the real presence of an internal link instead of the "[[" string
 * (bug 28287) The "your changes" box for edit conflicts is now read-only.
+* (bug 28940) When making a thumb of an SVG, and only specifying the height
+  make the width be the max SVG size, not the natrual width of the SVG.
 
 === API changes in 1.19 ===
 * (bug 27790) add query type for querymodules to action=paraminfo
index fd0b48a..3eaede6 100644 (file)
@@ -507,7 +507,14 @@ class Linker {
                        $fp['align']   = 'none';
                }
                if ( $file && !isset( $hp['width'] ) ) {
-                       $hp['width'] = $file->getWidth( $page );
+                       if ( isset( $hp['height'] ) && $file->isVectorized() ) {
+                               // If its a vector image, and user only specifies height
+                               // we don't want it to be limited by its "normal" width.
+                               global $wgSVGMaxSize;
+                               $hp['width'] = $wgSVGMaxSize;
+                       } else { 
+                               $hp['width'] = $file->getWidth( $page );
+                       }
 
                        if ( isset( $fp['thumbnail'] ) || isset( $fp['framed'] ) || isset( $fp['frameless'] ) || !$hp['width'] ) {
                                global $wgThumbLimits, $wgThumbUpright;