* @param array &$params
* @return bool
*/
- function normaliseParams( $image, &$params ) {
+ public function normaliseParams( $image, &$params ) {
global $wgMaxInterlacingAreas;
if ( !parent::normaliseParams( $image, $params ) ) {
return false;
* @param array &$params
* @return bool
*/
- function normaliseParams( $image, &$params ) {
+ public function normaliseParams( $image, &$params ) {
return ImageHandler::normaliseParams( $image, $params );
}
* @param array|null $params
* @return array
*/
- function getThumbType( $text, $mime, $params = null ) {
+ public function getThumbType( $text, $mime, $params = null ) {
return [ 'png', 'image/png' ];
}
/**
* @return bool
*/
- function isEnabled() {
+ public function isEnabled() {
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML;
if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) {
wfDebug( "DjVu is disabled, please set \$wgDjvuRenderer and \$wgDjvuDump\n" );
return $this->getDjVuImage( $image, $path )->getImageSize();
}
- function getThumbType( $ext, $mime, $params = null ) {
+ public function getThumbType( $ext, $mime, $params = null ) {
global $wgDjvuOutputExtension;
static $mime;
if ( !isset( $mime ) ) {
return [ $wgDjvuOutputExtension, $mime ];
}
- function getMetadata( $image, $path ) {
+ public function getMetadata( $image, $path ) {
wfDebug( "Getting DjVu metadata for $path\n" );
$xml = $this->getDjVuImage( $image, $path )->retrieveMetaData();
return 'djvuxml';
}
- function isMetadataValid( $image, $metadata ) {
+ public function isMetadataValid( $image, $metadata ) {
return !empty( $metadata ) && $metadata != serialize( [] );
}
- function pageCount( File $image ) {
+ public function pageCount( File $image ) {
$info = $this->getDimensionInfo( $image );
return $info ? $info['pageCount'] : false;
}
- function getPageDimensions( File $image, $page ) {
+ public function getPageDimensions( File $image, $page ) {
$index = $page - 1; // MW starts pages at 1
$info = $this->getDimensionInfo( $image );
* @param array $metadata
* @return bool|int
*/
- function isMetadataValid( $image, $metadata ) {
+ public function isMetadataValid( $image, $metadata ) {
global $wgShowEXIF;
if ( !$wgShowEXIF ) {
# Metadata disabled and so an empty field is expected
* @param bool|IContextSource $context Context to use (optional)
* @return array|bool
*/
- function formatMetadata( $image, $context = false ) {
+ public function formatMetadata( $image, $context = false ) {
$meta = $this->getCommonMetaArray( $image );
if ( count( $meta ) === 0 ) {
return false;
class GIFHandler extends BitmapHandler {
const BROKEN_FILE = '0'; // value to store in img_metadata if error extracting metadata.
- function getMetadata( $image, $filename ) {
+ public function getMetadata( $image, $filename ) {
try {
$parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename );
} catch ( Exception $e ) {
* @param bool|IContextSource $context Context to use (optional)
* @return array|bool
*/
- function formatMetadata( $image, $context = false ) {
+ public function formatMetadata( $image, $context = false ) {
$meta = $this->getCommonMetaArray( $image );
if ( count( $meta ) === 0 ) {
return false;
return 'parsed-gif';
}
- function isMetadataValid( $image, $metadata ) {
+ public function isMetadataValid( $image, $metadata ) {
if ( $metadata === self::BROKEN_FILE ) {
// Do not repetitivly regenerate metadata on broken file.
return self::METADATA_GOOD;
* @param File $image
* @return string
*/
- function getLongDesc( $image ) {
+ public function getLongDesc( $image ) {
global $wgLang;
$original = parent::getLongDesc( $image );
* @param File $file
* @return string
*/
- function getLongDesc( $file ) {
+ public function getLongDesc( $file ) {
global $wgLang;
$pages = $file->pageCount();
$size = htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
const SRGB_EXIF_COLOR_SPACE = 'sRGB';
const SRGB_ICC_PROFILE_DESCRIPTION = 'sRGB IEC61966-2.1';
- function normaliseParams( $image, &$params ) {
+ public function normaliseParams( $image, &$params ) {
if ( !parent::normaliseParams( $image, $params ) ) {
return false;
}
return $res;
}
- function getMetadata( $image, $filename ) {
+ public function getMetadata( $image, $filename ) {
try {
$meta = BitmapMetadataHandler::Jpeg( $filename );
if ( !is_array( $meta ) ) {
* @param File $image
* @param array &$params
*/
- abstract function normaliseParams( $image, &$params );
+ abstract public function normaliseParams( $image, &$params );
/**
* Get an image size array like that returned by getimagesize(), or false if it
* @param string $path The filename
* @return string A string of metadata in php serialized form (Run through serialize())
*/
- function getMetadata( $image, $path ) {
+ public function getMetadata( $image, $path ) {
return '';
}
* @param string $metadata The metadata in serialized form
* @return bool
*/
- function isMetadataValid( $image, $metadata ) {
+ public function isMetadataValid( $image, $metadata ) {
return self::METADATA_GOOD;
}
* @param array|null $params Handler specific rendering parameters
* @return array Thumbnail extension and MIME type
*/
- function getThumbType( $ext, $mime, $params = null ) {
+ public function getThumbType( $ext, $mime, $params = null ) {
$magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) {
// The extension is not valid for this MIME type and we do
* @param File $file
* @return bool
*/
- function pageCount( File $file ) {
+ public function pageCount( File $file ) {
return false;
}
* False if the handler is disabled for all files
* @return bool
*/
- function isEnabled() {
+ public function isEnabled() {
return true;
}
* @param int $page What page to get dimensions of
* @return array|bool
*/
- function getPageDimensions( File $image, $page ) {
+ public function getPageDimensions( File $image, $page ) {
$gis = $this->getImageSize( $image, $image->getLocalRefPath() );
if ( $gis ) {
return [
* @param bool|IContextSource $context Context to use (optional)
* @return array|bool
*/
- function formatMetadata( $image, $context = false ) {
+ public function formatMetadata( $image, $context = false ) {
return false;
}
* @param File $file
* @return string
*/
- function getLongDesc( $file ) {
+ public function getLongDesc( $file ) {
return self::getGeneralLongDesc( $file );
}
* @param string $fileName The local path to the file.
* @return Status
*/
- function verifyUpload( $fileName ) {
+ public function verifyUpload( $fileName ) {
return Status::newGood();
}
* @param string $filename
* @return string
*/
- function getMetadata( $image, $filename ) {
+ public function getMetadata( $image, $filename ) {
try {
$metadata = BitmapMetadataHandler::PNG( $filename );
} catch ( Exception $e ) {
* @param bool|IContextSource $context Context to use (optional)
* @return array|bool
*/
- function formatMetadata( $image, $context = false ) {
+ public function formatMetadata( $image, $context = false ) {
$meta = $this->getCommonMetaArray( $image );
if ( count( $meta ) === 0 ) {
return false;
return 'parsed-png';
}
- function isMetadataValid( $image, $metadata ) {
+ public function isMetadataValid( $image, $metadata ) {
if ( $metadata === self::BROKEN_FILE ) {
// Do not repetitivly regenerate metadata on broken file.
return self::METADATA_GOOD;
* @param File $image
* @return string
*/
- function getLongDesc( $image ) {
+ public function getLongDesc( $image ) {
global $wgLang;
$original = parent::getLongDesc( $image );
'title' => 'ObjectName',
];
- function isEnabled() {
+ public function isEnabled() {
global $wgSVGConverters, $wgSVGConverter;
if ( !isset( $wgSVGConverters[$wgSVGConverter] ) ) {
wfDebug( "\$wgSVGConverter is invalid, disabling SVG rendering.\n" );
}
}
- function getThumbType( $ext, $mime, $params = null ) {
+ public function getThumbType( $ext, $mime, $params = null ) {
return [ 'png', 'image/png' ];
}
* @param File $file
* @return string
*/
- function getLongDesc( $file ) {
+ public function getLongDesc( $file ) {
global $wgLang;
$metadata = $this->unpackMetadata( $file->getMetadata() );
* @param string $filename
* @return string Serialised metadata
*/
- function getMetadata( $file, $filename ) {
+ public function getMetadata( $file, $filename ) {
$metadata = [ 'version' => self::SVG_METADATA_VERSION ];
try {
$metadata += SVGMetadataExtractor::getMetadata( $filename );
return 'parsed-svg';
}
- function isMetadataValid( $image, $metadata ) {
+ public function isMetadataValid( $image, $metadata ) {
$meta = $this->unpackMetadata( $metadata );
if ( $meta === false ) {
return self::METADATA_BAD;
* @param bool|IContextSource $context Context to use (optional)
* @return array|bool
*/
- function formatMetadata( $file, $context = false ) {
+ public function formatMetadata( $file, $context = false ) {
$result = [
'visible' => [],
'collapsed' => []
* @param array|null $params
* @return bool
*/
- function getThumbType( $ext, $mime, $params = null ) {
+ public function getThumbType( $ext, $mime, $params = null ) {
global $wgTiffThumbnailType;
return $wgTiffThumbnailType;
* @throws MWException
* @return string
*/
- function getMetadata( $image, $filename ) {
+ public function getMetadata( $image, $filename ) {
global $wgShowEXIF;
if ( $wgShowEXIF ) {
* 'physicalWidth' and 'physicalHeight' indicate the thumbnail dimensions.
* @return bool
*/
- function normaliseParams( $image, &$params ) {
+ public function normaliseParams( $image, &$params ) {
if ( !parent::normaliseParams( $image, $params ) ) {
return false;
}
* @param array|null $params
* @return array
*/
- function getThumbType( $ext, $mime, $params = null ) {
+ public function getThumbType( $ext, $mime, $params = null ) {
return [ 'png', 'image/png' ];
}
*/
class MockDjVuHandler extends DjVuHandler {
- function isEnabled() {
+ public function isEnabled() {
return true;
}