r66637 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66636‎ | r66637 | r66638 >
Date:00:40, 19 May 2010
Author:hartman
Status:ok (Comments)
Tags:
Comment:
Repair makeThumbLink2() getUnscaledThumb() to pass along the handlerparams to transform()
Fixes bug 23577
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -594,14 +594,14 @@
595595 if( $manual_title ) {
596596 $manual_img = wfFindFile( $manual_title );
597597 if ( $manual_img ) {
598 - $thumb = $manual_img->getUnscaledThumb();
 598+ $thumb = $manual_img->getUnscaledThumb( $hp );
599599 } else {
600600 $exists = false;
601601 }
602602 }
603603 } elseif ( isset( $fp['framed'] ) ) {
604604 // Use image dimensions, don't scale
605 - $thumb = $file->getUnscaledThumb( $page );
 605+ $thumb = $file->getUnscaledThumb( $hp );
606606 } else {
607607 # Do not present an image bigger than the source, for bitmap-style images
608608 # This is a hack to maintain compatibility with arbitrary pre-1.10 behaviour
Index: trunk/phase3/includes/filerepo/File.php
@@ -438,20 +438,15 @@
439439 /**
440440 * Get a ThumbnailImage which is the same size as the source
441441 */
442 - function getUnscaledThumb( $page = false ) {
 442+ function getUnscaledThumb( $handlerParams = array() ) {
 443+ $hp =& $handlerParams;
 444+ $page = isset( $hp['page'] ) ? $hp['page'] : false;
443445 $width = $this->getWidth( $page );
444446 if ( !$width ) {
445447 return $this->iconThumb();
446448 }
447 - if ( $page ) {
448 - $params = array(
449 - 'page' => $page,
450 - 'width' => $this->getWidth( $page )
451 - );
452 - } else {
453 - $params = array( 'width' => $this->getWidth() );
454 - }
455 - return $this->transform( $params );
 449+ $hp['width'] = $width;
 450+ return $this->transform( $hp );
456451 }
457452
458453 /**

Comments

#Comment by Catrope (talk | contribs)   21:31, 14 December 2010
+		$hp =& $handlerParams;

I can't see why a reference assignment is needed here.

#Comment by TheDJ (talk | contribs)   23:30, 14 December 2010

Probably because the Linker was doing it as well.

Status & tagging log