* Do not present an image bigger than the source when 'frameless' option is used
authorRaimond Spekking <raymond@users.mediawiki.org>
Tue, 20 Nov 2007 12:11:05 +0000 (12:11 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Tue, 20 Nov 2007 12:11:05 +0000 (12:11 +0000)
* This is consistent with the 'thumb' option now:
** Unchanged: [[Image:xyz.jpg|thumb]], [[Image:xyz.jpg|thumb|200px]] do not blow up an image larger than the source
** Unchanged: [[Image:xyz.jpg|frameless]] does not blow up an image
** New: [[Image:xyz.jpg|frameless|200px]] does not blow up an image
** Unchanged: [[Image:xyz.jpg|200px]] still blows up an image

RELEASE-NOTES
includes/Linker.php

index fe952aa..c6ec648 100644 (file)
@@ -173,6 +173,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Ensure that rate-limiting is applied to rollbacks.
 * Make a better rate-limiting error message (i.e. a normal MW error,
   rather than an "Internal Server Error").
+* Do not present an image bigger than the source when 'frameless' option is used
+  (to be consistent with the 'thumb' option now)
 
 == Parser changes in 1.12 ==
 
index 94f6b05..9e38a41 100644 (file)
@@ -555,6 +555,15 @@ class Linker {
                        return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp ).$postfix;
                }
 
+               if ( $file && isset( $fp['frameless'] ) ) {
+                       $srcWidth = $file->getWidth( $page );
+                       # For "frameless" option: do not present an image bigger than the source (for bitmap-style images)
+                       # This is the same behaviour as the "thumb" option does it already.
+                       if ( $srcWidth && !$file->mustRender() && $hp['width'] > $srcWidth ) {
+                               $hp['width'] = $srcWidth;
+                       }
+               }
+
                if ( $file && $hp['width'] ) {
                        # Create a resized image, without the additional thumbnail features
                        $thumb = $file->transform( $hp );
@@ -1379,7 +1388,3 @@ class Linker {
                return $out;
        }
 }
-
-
-
-