This will only include the number of pages if there is at least two pages.
If you have a pdf with a single page, it won't say 1 page. I modeled this
on how animated images will only say x frames if x > 1.
(For reference, this will affect extensions like pdfHandler, but it won't
affect extensions like PagedTiffHandler since that one totally overrides
the default method)
*/
function getLongDesc( $file ) {
global $wgLang;
- return wfMsgExt('file-info-size', 'parseinline',
- $wgLang->formatNum( $file->getWidth() ),
- $wgLang->formatNum( $file->getHeight() ),
- $wgLang->formatSize( $file->getSize() ),
- $file->getMimeType() );
+ $pages = $file->pageCount();
+ if ( $pages === false || $pages <= 1 ) {
+ $msg = wfMsgExt('file-info-size', 'parseinline',
+ $wgLang->formatNum( $file->getWidth() ),
+ $wgLang->formatNum( $file->getHeight() ),
+ $wgLang->formatSize( $file->getSize() ),
+ $file->getMimeType() );
+ } else {
+ $msg = wfMsgExt('file-info-size-pages', 'parseinline',
+ $wgLang->formatNum( $file->getWidth() ),
+ $wgLang->formatNum( $file->getHeight() ),
+ $wgLang->formatSize( $file->getSize() ),
+ $file->getMimeType(),
+ $wgLang->formatNum( $pages ) );
+ }
+ return $msg;
}
/**
'widthheightpage' => '$1×$2, $3 {{PLURAL:$3|page|pages}}',
'file-info' => 'file size: $1, MIME type: $2',
'file-info-size' => '$1 × $2 pixels, file size: $3, MIME type: $4',
+'file-info-size-pages' => '$1 × $2 pixels, file size: $3, MIME type: $4, $5 pages',
'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',
'widthheightpage' => 'This message is used on image pages in the dimensions column in the file history section for images with more than one page. Parameter $1 is the image width (in pixels), parameter $2 is the image height, and parameter $3 is the number of pages.',
'file-info' => 'File info displayed on file description page.',
'file-info-size' => 'File info displayed on file description page.',
+'file-info-size-pages' => 'File info displayed on file description page, when the file is a multi-page document, with at least two pages. Like {{msg-mw|file-info-size}} but $5 is the total number of pages in the document.',
'file-nohires' => 'File info displayed on file description page. For example of message in use see [[:File:Mouse10.gif]].',
'svg-long-desc' => 'Displayed under an SVG image at the image description page. Note that argument 3 is a string that includes the file size unit symbol. See for example [[:File:Yes check.svg]].',
'show-big-image' => 'Displayed under an image at the image description page, when it is displayed smaller there than it was uploaded.',
'widthheightpage',
'file-info',
'file-info-size',
+ 'file-info-size-pages',
'file-nohires',
'svg-long-desc',
'show-big-image',