From c842022728d5c532bb9d5b07bb8c3edebddea2b8 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 18 Sep 2007 13:24:53 +0000 Subject: [PATCH] Moving code from Linker::makeThumbLink2 to Linker::makeImageLink2 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 | 1 + includes/Linker.php | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5a9945a68c..fa9957c2f8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Linker.php b/includes/Linker.php index 9397b80055..0836cf5ead 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -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; } } - - - - -- 2.20.1