}
$otherSizes = array_unique( $otherSizes );
- $msgsmall = '';
$sizeLinkBigImagePreview = $this->makeSizeLink( $params, $width, $height );
- if ( $sizeLinkBigImagePreview ) {
- $msgsmall .= $this->getContext()->msg( 'show-big-image-preview' )->
- rawParams( $sizeLinkBigImagePreview )->
- parse();
- }
+ $msgsmall = $this->getThumbPrevText( $params, $sizeLinkBigImagePreview );
if ( count( $otherSizes ) ) {
$msgsmall .= ' ' .
Html::rawElement(
$out->setFileVersion( $this->displayImg );
}
+ /**
+ * Make the text under the image to say what size preview
+ *
+ * @param $params Array parameters for thumbnail
+ * @param $sizeLinkBigImagePreview HTML for the current size
+ * @return string HTML output
+ */
+ private function getThumbPrevText( $params, $sizeLinkBigImagePreview ) {
+ if ( $sizeLinkBigImagePreview ) {
+ // Show a different message of preview is different format from original.
+ $previewTypeDiffers = false;
+ $origExt = $thumbExt = $this->displayImg->getExtension();
+ if ( $this->displayImg->getHandler() ) {
+ $origMime = $this->displayImg->getMimeType();
+ $typeParams = $params;
+ $this->displayImg->getHandler()->normaliseParams( $this->displayImg, $typeParams );
+ list( $thumbExt, $thumbMime ) = $this->displayImg->getHandler()->getThumbType(
+ $origExt, $origMime, $typeParams );
+ if ( $thumbMime !== $origMime ) {
+ $previewTypeDiffers = true;
+ }
+ }
+ if ( $previewTypeDiffers ) {
+ return $this->getContext()->msg( 'show-big-image-preview-differ' )->
+ rawParams( $sizeLinkBigImagePreview )->
+ params( strtoupper( $origExt ) )->
+ params( strtoupper( $thumbExt ) )->
+ parse();
+ } else {
+ return $this->getContext()->msg( 'show-big-image-preview' )->
+ rawParams( $sizeLinkBigImagePreview )->
+ parse();
+ }
+ } else {
+ return '';
+ }
+ }
+
/**
* Creates an thumbnail of specified size and returns an HTML link to it
* @param array $params Scaler parameters
"svg-long-error": "Invalid SVG file: $1",
"show-big-image": "Original file",
"show-big-image-preview": "Size of this preview: $1.",
+ "show-big-image-preview-differ": "Size of this $3 preview of this $2 file: $1.",
"show-big-image-other": "Other {{PLURAL:$2|resolution|resolutions}}: $1.",
"show-big-image-size": "$1 × $2 pixels",
"file-info-gif-looped": "looped",
"svg-long-error": "Displayed for invalid SVG file metadata. Parameters:\n* $1 - the error message\nSee also:\n* {{msg-mw|Thumbnail error}}",
"show-big-image": "Displayed under the file on file description pages, when a reduced-size thumbnail of the original file is being displayed.\n{{Identical|Original file}}",
"show-big-image-preview": "Message shown under the image description page thumbnail.\n\nCan be followed by {{msg-mw|Show-big-image-other}}.\n\nParameters:\n* $1 - a link which points to the thumbnail. Its text is {{msg-mw|Show-big-image-size}}",
+ "show-big-image-preview-differ": "Like {{msg-mw|show-big-image-preview}}, but used in the case where the thumbnail of the file is in a different format than the original image (e.g. For SVG or DjVu files).\n\n* $1 - a link which points to the thumbnail. Its text is {{msg-mw|Show-big-image-size}}\n* $2 Uppercase normalized extension of original file.\n* $3 Uppercased extension of thumbnail.",
"show-big-image-other": "Message shown under the image description page thumbnail.\n\nPreceded by {{msg-mw|Show-big-image-preview}}, if the image is in high resolution.\n\nParameters:\n* $1 - list of resolutions (pipe-separated)\n* $2 - number of resolutions",
"show-big-image-size": "Parameters:\n* $1 - the width of the image(s) in pixels\n* $2 - the height of the image(s) in pixels",
"file-info-gif-looped": "Part of the information provided about a [[w:Gif|.gif file]] on its file description page. Looped means repeating in the context of an animated gif. It is a sequence of images, each displayed after the other, and the first one displayed after the last, in a never ending loop. For example of message in use see [[:File:Mouse10.gif]].\n{{Identical|Looped}}",