Moving code from Linker::makeThumbLink2 to Linker::makeImageLink2
authorRaimond Spekking <raymond@users.mediawiki.org>
Tue, 18 Sep 2007 13:24:53 +0000 (13:24 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Tue, 18 Sep 2007 13:24:53 +0000 (13:24 +0000)
This will prevent bigger images than the source (for bitmap-style images)
[[Image:smallIconWith25px.png|200px]] does not blow the bitmap to 200px width
Now the same behavior as [[Image:smallIconWith25px.png|thumb|200px]] which prevents blow up already.

RELEASE-NOTES
includes/Linker.php

index 5a9945a..fa9957c 100644 (file)
@@ -59,6 +59,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Strike the link to the redirect rather than using an asterisk in Special:Listredirects
 * (bug 11355) Fix false positives in Safe Mode and other config detection
   when boolean settings are disabled with 'Off' via php_admin_value/php_value
+* Do not present an image bigger than the source, for bitmap-style images
 
 === API changes in 1.12 ===
 
index 9397b80..0836cf5 100644 (file)
@@ -544,6 +544,15 @@ class Linker {
                        }
                }
 
+               if ( $file && $hp['width'] ) {
+                       # Do not present an image bigger than the source, for bitmap-style images
+                       # This is a hack to maintain compatibility with arbitrary pre-1.10 behaviour
+                       $srcWidth = $file->getWidth( $page );
+                       if ( $srcWidth && !$file->mustRender() && $hp['width'] > $srcWidth ) {
+                               $hp['width'] = $srcWidth;
+                       }
+               }
+
                if ( isset( $fp['thumbnail'] ) || isset( $fp['manualthumb'] ) || isset( $fp['framed'] ) ) {
 
                        # Create a thumbnail. Alignment depends on language
@@ -634,12 +643,6 @@ class Linker {
                                // Use image dimensions, don't scale
                                $thumb = $file->getUnscaledThumb( $page );
                        } else {
-                               # Do not present an image bigger than the source, for bitmap-style images
-                               # This is a hack to maintain compatibility with arbitrary pre-1.10 behaviour
-                               $srcWidth = $file->getWidth( $page );
-                               if ( $srcWidth && !$file->mustRender() && $hp['width'] > $srcWidth ) {
-                                       $hp['width'] = $srcWidth;
-                               }
                                $thumb = $file->transform( $hp );
                        }
 
@@ -1373,7 +1376,3 @@ class Linker {
                return $out;
        }
 }
-
-
-
-