Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4777,7 +4777,7 @@ |
4778 | 4778 | wfRunHooks( 'ParserMakeImageParams', array( $title, $file, &$params ) ); |
4779 | 4779 | |
4780 | 4780 | # Linker does the rest |
4781 | | - $ret = $sk->makeImageLink2( $title, $file, $params['frame'], $params['handler'], $time, $descQuery ); |
| 4781 | + $ret = $sk->makeImageLink2( $title, $file, $params['frame'], $params['handler'], $time, $descQuery, $this->mOptions->getThumbSize() ); |
4782 | 4782 | |
4783 | 4783 | # Give the handler a chance to modify the parser object |
4784 | 4784 | if ( $handler ) { |
Index: trunk/phase3/includes/parser/ParserOptions.php |
— | — | @@ -31,6 +31,7 @@ |
32 | 32 | var $mExternalLinkTarget; # Target attribute for external links |
33 | 33 | var $mMath; # User math preference (as integer) |
34 | 34 | var $mUserLang; # Language code of the User language. |
| 35 | + var $mThumbSize; # Thumb size preferred by the user. |
35 | 36 | |
36 | 37 | var $mUser; # Stored user object, just used to initialise the skin |
37 | 38 | var $mIsPreview; # Parsing the page for a "preview" operation |
— | — | @@ -58,6 +59,7 @@ |
59 | 60 | function getCleanSignatures() { return $this->mCleanSignatures; } |
60 | 61 | function getExternalLinkTarget() { return $this->mExternalLinkTarget; } |
61 | 62 | function getMath() { return $this->mMath; } |
| 63 | + function getThumbSize() { return $this->mThumbSize; } |
62 | 64 | |
63 | 65 | function getIsPreview() { return $this->mIsPreview; } |
64 | 66 | function getIsSectionPreview() { return $this->mIsSectionPreview; } |
— | — | @@ -115,6 +117,7 @@ |
116 | 118 | function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); } |
117 | 119 | function setMath( $x ) { return wfSetVar( $this->mMath, $x ); } |
118 | 120 | function setUserLang( $x ) { return wfSetVar( $this->mUserLang, $x ); } |
| 121 | + function setThumbSize() { return wfSetVar( $this->mThumbSize, $x ); } |
119 | 122 | |
120 | 123 | function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); } |
121 | 124 | function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); } |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -433,7 +433,7 @@ |
434 | 434 | * @param $query String: query params for desc url |
435 | 435 | * @return String: HTML for an image, with links, wrappers, etc. |
436 | 436 | */ |
437 | | - function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "" ) { |
| 437 | + function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "", $widthOption = null ) { |
438 | 438 | $res = null; |
439 | 439 | if( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$this, &$title, |
440 | 440 | &$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) { |
— | — | @@ -467,10 +467,8 @@ |
468 | 468 | $hp['width'] = $file->getWidth( $page ); |
469 | 469 | |
470 | 470 | if( isset( $fp['thumbnail'] ) || isset( $fp['framed'] ) || isset( $fp['frameless'] ) || !$hp['width'] ) { |
471 | | - $wopt = $wgUser->getOption( 'thumbsize' ); |
472 | | - |
473 | | - if( !isset( $wgThumbLimits[$wopt] ) ) { |
474 | | - $wopt = User::getDefaultOption( 'thumbsize' ); |
| 471 | + if( !isset( $widthOption ) || !isset( $wgThumbLimits[$widthOption] ) ) { |
| 472 | + $widthOption = User::getDefaultOption( 'thumbsize' ); |
475 | 473 | } |
476 | 474 | |
477 | 475 | // Reduce width for upright images when parameter 'upright' is used |
— | — | @@ -480,8 +478,8 @@ |
481 | 479 | // Use width which is smaller: real image width or user preference width |
482 | 480 | // For caching health: If width scaled down due to upright parameter, round to full __0 pixel to avoid the creation of a lot of odd thumbs |
483 | 481 | $prefWidth = isset( $fp['upright'] ) ? |
484 | | - round( $wgThumbLimits[$wopt] * $fp['upright'], -1 ) : |
485 | | - $wgThumbLimits[$wopt]; |
| 482 | + round( $wgThumbLimits[$widthOption] * $fp['upright'], -1 ) : |
| 483 | + $wgThumbLimits[$widthOption]; |
486 | 484 | if ( $hp['width'] <= 0 || $prefWidth < $hp['width'] ) { |
487 | 485 | if( !isset( $hp['height'] ) ) { |
488 | 486 | $hp['width'] = $prefWidth; |