<?php
-
/**
* Media-handling base classes and generic functionality
+ * @file
+ * @ingroup Media
*/
/**
* Base media handler class
*
- * @addtogroup Media
+ * @ingroup Media
*/
abstract class MediaHandler {
const TRANSFORM_LATER = 1;
);
}
+ /**
+ * Generic getter for text layer.
+ * Currently overloaded by PDF and DjVu handlers
+ */
+ function getPageText( $image, $page ) {
+ return false;
+ }
+
/**
* Get an array structure that looks like this:
*
function getLongDesc( $file ) {
global $wgUser;
$sk = $wgUser->getSkin();
- return wfMsg( 'file-info', $sk->formatSize( $file->getSize() ), $file->getMimeType() );
+ return wfMsgExt( 'file-info', 'parseinline',
+ $sk->formatSize( $file->getSize() ),
+ $file->getMimeType() );
+ }
+
+ static function getGeneralShortDesc( $file ) {
+ global $wgLang;
+ $nbytes = '(' . wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
+ $wgLang->formatNum( $file->getSize() ) ) . ')';
+ return "$nbytes";
+ }
+
+ static function getGeneralLongDesc( $file ) {
+ global $wgUser;
+ $sk = $wgUser->getSkin();
+ return wfMsgExt( 'file-info', 'parseinline',
+ $sk->formatSize( $file->getSize() ),
+ $file->getMimeType() );
}
function getDimensionsString( $file ) {
/**
* Media handler abstract base class for images
*
- * @addtogroup Media
+ * @ingroup Media
*/
abstract class ImageHandler extends MediaHandler {
function canRender( $file ) {
function getLongDesc( $file ) {
global $wgLang;
- return wfMsgHtml('file-info-size', $wgLang->formatNum( $file->getWidth() ), $wgLang->formatNum( $file->getHeight() ),
- $wgLang->formatSize( $file->getSize() ), $file->getMimeType() );
+ return wfMsgExt('file-info-size', 'parseinline',
+ $wgLang->formatNum( $file->getWidth() ),
+ $wgLang->formatNum( $file->getHeight() ),
+ $wgLang->formatSize( $file->getSize() ),
+ $file->getMimeType() );
}
function getDimensionsString( $file ) {
global $wgLang;
$pages = $file->pageCount();
+ $width = $wgLang->formatNum( $file->getWidth() );
+ $height = $wgLang->formatNum( $file->getHeight() );
+ $pagesFmt = $wgLang->formatNum( $pages );
+
if ( $pages > 1 ) {
- return wfMsg( 'widthheightpage', $wgLang->formatNum( $file->getWidth() ), $wgLang->formatNum( $file->getHeight() ), $wgLang->formatNum( $pages ) );
+ return wfMsgExt( 'widthheightpage', 'parsemag', $width, $height, $pagesFmt );
} else {
- return wfMsg( 'widthheight', $wgLang->formatNum( $file->getWidth() ), $wgLang->formatNum( $file->getHeight() ) );
+ return wfMsg( 'widthheight', $width, $height );
}
}
}