* @param $query String: query params for desc url
* @return String: HTML for an image, with links, wrappers, etc.
*/
- function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "" ) {
+ function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "", $widthOption = null ) {
$res = null;
if( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$this, &$title,
&$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) {
$hp['width'] = $file->getWidth( $page );
if( isset( $fp['thumbnail'] ) || isset( $fp['framed'] ) || isset( $fp['frameless'] ) || !$hp['width'] ) {
- $wopt = $wgUser->getOption( 'thumbsize' );
-
- if( !isset( $wgThumbLimits[$wopt] ) ) {
- $wopt = User::getDefaultOption( 'thumbsize' );
+ if( !isset( $widthOption ) || !isset( $wgThumbLimits[$widthOption] ) ) {
+ $widthOption = User::getDefaultOption( 'thumbsize' );
}
// Reduce width for upright images when parameter 'upright' is used
// Use width which is smaller: real image width or user preference width
// 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
$prefWidth = isset( $fp['upright'] ) ?
- round( $wgThumbLimits[$wopt] * $fp['upright'], -1 ) :
- $wgThumbLimits[$wopt];
+ round( $wgThumbLimits[$widthOption] * $fp['upright'], -1 ) :
+ $wgThumbLimits[$widthOption];
if ( $hp['width'] <= 0 || $prefWidth < $hp['width'] ) {
if( !isset( $hp['height'] ) ) {
$hp['width'] = $prefWidth;
wfRunHooks( 'ParserMakeImageParams', array( $title, $file, &$params ) );
# Linker does the rest
- $ret = $sk->makeImageLink2( $title, $file, $params['frame'], $params['handler'], $time, $descQuery );
+ $ret = $sk->makeImageLink2( $title, $file, $params['frame'], $params['handler'], $time, $descQuery, $this->mOptions->getThumbSize() );
# Give the handler a chance to modify the parser object
if ( $handler ) {
var $mExternalLinkTarget; # Target attribute for external links
var $mMath; # User math preference (as integer)
var $mUserLang; # Language code of the User language.
+ var $mThumbSize; # Thumb size preferred by the user.
var $mUser; # Stored user object, just used to initialise the skin
var $mIsPreview; # Parsing the page for a "preview" operation
function getCleanSignatures() { return $this->mCleanSignatures; }
function getExternalLinkTarget() { return $this->mExternalLinkTarget; }
function getMath() { return $this->mMath; }
+ function getThumbSize() { return $this->mThumbSize; }
function getIsPreview() { return $this->mIsPreview; }
function getIsSectionPreview() { return $this->mIsSectionPreview; }
function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); }
function setMath( $x ) { return wfSetVar( $this->mMath, $x ); }
function setUserLang( $x ) { return wfSetVar( $this->mUserLang, $x ); }
+ function setThumbSize() { return wfSetVar( $this->mThumbSize, $x ); }
function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); }
function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); }