Repair makeThumbLink2() getUnscaledThumb() to pass along the handlerparams to transform()
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 19 May 2010 00:40:48 +0000 (00:40 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 19 May 2010 00:40:48 +0000 (00:40 +0000)
Fixes bug 23577

includes/Linker.php
includes/filerepo/File.php

index 1398a44..13c68af 100644 (file)
@@ -594,14 +594,14 @@ class Linker {
                                if( $manual_title ) {
                                        $manual_img = wfFindFile( $manual_title );
                                        if ( $manual_img ) {
-                                               $thumb = $manual_img->getUnscaledThumb();
+                                               $thumb = $manual_img->getUnscaledThumb( $hp );
                                        } else {
                                                $exists = false;
                                        }
                                }
                        } elseif ( isset( $fp['framed'] ) ) {
                                // Use image dimensions, don't scale
-                               $thumb = $file->getUnscaledThumb( $page );
+                               $thumb = $file->getUnscaledThumb( $hp );
                        } 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
index b0ce671..9e98348 100644 (file)
@@ -438,20 +438,15 @@ abstract class File {
        /**
         * Get a ThumbnailImage which is the same size as the source
         */
-       function getUnscaledThumb( $page = false ) {
+       function getUnscaledThumb( $handlerParams = array() ) {
+               $hp =& $handlerParams;
+               $page = isset( $hp['page'] ) ? $hp['page'] : false;
                $width = $this->getWidth( $page );
                if ( !$width ) {
                        return $this->iconThumb();
                }
-               if ( $page ) {
-                       $params = array(
-                               'page' => $page,
-                               'width' => $this->getWidth( $page )
-                       );
-               } else {
-                       $params = array( 'width' => $this->getWidth() );
-               }
-               return $this->transform( $params );
+               $hp['width'] = $width;
+               return $this->transform( $hp );
        }
 
        /**