* (bug 14706) Added support for the Imagick PHP extension.
* (bug 18691) Added support for SVG rasterization using the Imagick PHP
extension
+* (bug 2581, bug 6834) Added links to thumbnail in several resolutions to the
+ file description page. The sizes are set by $wgImageLimits.
=== Bug fixes in 1.18 ===
* (bug 23119) WikiError class and subclasses are now marked as deprecated
# because of rounding.
}
$msgbig = wfMsgHtml( 'show-big-image' );
- $msgsmall = wfMsgExt( 'show-big-image-thumb', 'parseinline',
- $wgLang->formatNum( $width ),
- $wgLang->formatNum( $height )
- );
+ $otherSizes = array();
+ foreach ( $wgImageLimits as $size ) {
+ if ( $size[0] < $width_orig && $size[1] < $height_orig &&
+ $size[0] != $width && $size[1] != $height ) {
+ $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] );
+ }
+ }
+ $msgsmall = wfMessage( 'show-big-image-preview' )->
+ rawParams( $this->makeSizeLink( $params, $width, $height ) )->
+ parse() . ' ' .
+ wfMessage( 'show-big-image-other' )->
+ rawParams( $wgLang->pipeList( $otherSizes ) )->parse();
} else {
# Image is small enough to show full size on image page
$msgsmall = wfMsgExt( 'file-nohires', array( 'parseinline' ) );
}
$params['width'] = $width;
+ $params['height'] = $height;
$thumbnail = $this->displayImg->transform( $params );
$showLink = true;
}
}
}
+
+ /**
+ * Creates an thumbnail of specified size and returns an HTML link to it
+ * @param array $params Scaler parameters
+ * @param int $width
+ * @param int $height
+ */
+ private function makeSizeLink( $params, $width, $height ) {
+ global $wgLang;
+
+ $params['width'] = $width;
+ $params['height'] = $height;
+ $thumbnail = $this->displayImg->transform( $params );
+ if ( $thumbnail && !$thumbnail->isError() ) {
+ return Html::rawElement( 'a', array(
+ 'href' => $thumbnail->getUrl(),
+ 'class' => 'mw-thumbnail-link'
+ ), wfMessage( 'show-big-image-size' )->numParams(
+ $thumbnail->getWidth(), $thumbnail->getHeight()
+ )->parse() );
+ } else {
+ return '';
+ }
+ }
/**
* Show a notice that the file is from a shared repository
'file-nohires' => '<small>No higher resolution available.</small>',
'svg-long-desc' => 'SVG file, nominally $1 × $2 pixels, file size: $3',
'show-big-image' => 'Full resolution',
-'show-big-image-thumb' => '<small>Size of this preview: $1 × $2 pixels</small>',
+'show-big-image-preview' => '<small> Size of this preview: $1.</small>',
+'show-big-image-other' => '<small>Other resolutions: $1.</small>',
+'show-big-image-size' => '$1 × $2 pixels',
'file-info-gif-looped' => 'looped',
'file-info-gif-frames' => '$1 {{PLURAL:$1|frame|frames}}',
'file-info-png-looped' => 'looped',