MediaWiki  1.23.2
MediaHandler.php
Go to the documentation of this file.
1 <?php
29 abstract class MediaHandler {
30  const TRANSFORM_LATER = 1;
31  const METADATA_GOOD = true;
32  const METADATA_BAD = false;
33  const METADATA_COMPATIBLE = 2; // for old but backwards compatible.
37  const MAX_ERR_LOG_SIZE = 65535;
38 
40  protected static $handlers = array();
41 
48  static function getHandler( $type ) {
49  global $wgMediaHandlers;
50  if ( !isset( $wgMediaHandlers[$type] ) ) {
51  wfDebug( __METHOD__ . ": no handler found for $type.\n" );
52 
53  return false;
54  }
55  $class = $wgMediaHandlers[$type];
56  if ( !isset( self::$handlers[$class] ) ) {
57  self::$handlers[$class] = new $class;
58  if ( !self::$handlers[$class]->isEnabled() ) {
59  self::$handlers[$class] = false;
60  }
61  }
62 
63  return self::$handlers[$class];
64  }
65 
70  abstract function getParamMap();
71 
80  abstract function validateParam( $name, $value );
81 
88  abstract function makeParamString( $params );
89 
96  abstract function parseParamString( $str );
97 
105  abstract function normaliseParams( $image, &$params );
106 
116  abstract function getImageSize( $image, $path );
117 
126  function getMetadata( $image, $path ) {
127  return '';
128  }
129 
145  static function getMetadataVersion() {
146  $version = array( '2' ); // core metadata version
147  wfRunHooks( 'GetMetadataVersion', array( &$version ) );
148 
149  return implode( ';', $version );
150  }
151 
162  function convertMetadataVersion( $metadata, $version = 1 ) {
163  if ( !is_array( $metadata ) ) {
164 
165  //unserialize to keep return parameter consistent.
167  $ret = unserialize( $metadata );
169 
170  return $ret;
171  }
172 
173  return $metadata;
174  }
175 
181  function getMetadataType( $image ) {
182  return false;
183  }
184 
196  function isMetadataValid( $image, $metadata ) {
197  return self::METADATA_GOOD;
198  }
199 
232  public function getCommonMetaArray( File $file ) {
233  return false;
234  }
235 
248  function getScriptedTransform( $image, $script, $params ) {
249  return false;
250  }
251 
262  final function getTransform( $image, $dstPath, $dstUrl, $params ) {
263  return $this->doTransform( $image, $dstPath, $dstUrl, $params, self::TRANSFORM_LATER );
264  }
265 
278  abstract function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 );
279 
288  function getThumbType( $ext, $mime, $params = null ) {
289  $magic = MimeMagic::singleton();
290  if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) {
291  // The extension is not valid for this mime type and we do
292  // recognize the mime type
293  $extensions = $magic->getExtensionsForType( $mime );
294  if ( $extensions ) {
295  return array( strtok( $extensions, ' ' ), $mime );
296  }
297  }
298 
299  // The extension is correct (true) or the mime type is unknown to
300  // MediaWiki (null)
301  return array( $ext, $mime );
302  }
303 
310  public function getStreamHeaders( $metadata ) {
311  return array();
312  }
313 
320  function canRender( $file ) {
321  return true;
322  }
323 
331  function mustRender( $file ) {
332  return false;
333  }
334 
341  function isMultiPage( $file ) {
342  return false;
343  }
344 
351  function pageCount( $file ) {
352  return false;
353  }
354 
361  function isVectorized( $file ) {
362  return false;
363  }
364 
373  function isAnimatedImage( $file ) {
374  return false;
375  }
376 
385  return true;
386  }
387 
392  function isEnabled() {
393  return true;
394  }
395 
412  function getPageDimensions( $image, $page ) {
413  $gis = $this->getImageSize( $image, $image->getLocalRefPath() );
414  if ( $gis ) {
415  return array(
416  'width' => $gis[0],
417  'height' => $gis[1]
418  );
419  } else {
420  return false;
421  }
422  }
423 
432  function getPageText( $image, $page ) {
433  return false;
434  }
435 
441  public function getEntireText( File $file ) {
442  $numPages = $file->pageCount();
443  if ( !$numPages ) {
444  // Not a multipage document
445  return $this->getPageText( $file, 1 );
446  }
447  $document = '';
448  for ( $i = 1; $i <= $numPages; $i++ ) {
449  $curPage = $this->getPageText( $file, $i );
450  if ( is_string( $curPage ) ) {
451  $document .= $curPage . "\n";
452  }
453  }
454  if ( $document !== '' ) {
455  return $document;
456  }
457  return false;
458  }
459 
487  function formatMetadata( $image ) {
488  return false;
489  }
490 
500  function formatMetadataHelper( $metadataArray ) {
501  $result = array(
502  'visible' => array(),
503  'collapsed' => array()
504  );
505 
506  $formatted = FormatMetadata::getFormattedData( $metadataArray );
507  // Sort fields into visible and collapsed
508  $visibleFields = $this->visibleMetadataFields();
509  foreach ( $formatted as $name => $value ) {
510  $tag = strtolower( $name );
512  in_array( $tag, $visibleFields ) ? 'visible' : 'collapsed',
513  'exif',
514  $tag,
515  $value
516  );
517  }
518 
519  return $result;
520  }
521 
528  protected function visibleMetadataFields() {
530  }
531 
555  protected static function addMeta( &$array, $visibility, $type, $id, $value, $param = false ) {
556  $msg = wfMessage( "$type-$id", $param );
557  if ( $msg->exists() ) {
558  $name = $msg->text();
559  } else {
560  // This is for future compatibility when using instant commons.
561  // So as to not display as ugly a name if a new metadata
562  // property is defined that we don't know about
563  // (not a major issue since such a property would be collapsed
564  // by default).
565  wfDebug( __METHOD__ . ' Unknown metadata name: ' . $id . "\n" );
566  $name = wfEscapeWikiText( $id );
567  }
568  $array[$visibility][] = array(
569  'id' => "$type-$id",
570  'name' => $name,
571  'value' => $value
572  );
573  }
574 
581  function getShortDesc( $file ) {
582  global $wgLang;
583 
584  return htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
585  }
586 
593  function getLongDesc( $file ) {
594  global $wgLang;
595 
596  return wfMessage( 'file-info', htmlspecialchars( $wgLang->formatSize( $file->getSize() ) ),
597  $file->getMimeType() )->parse();
598  }
599 
606  static function getGeneralShortDesc( $file ) {
607  global $wgLang;
608 
609  return $wgLang->formatSize( $file->getSize() );
610  }
611 
618  static function getGeneralLongDesc( $file ) {
619  global $wgLang;
620 
621  return wfMessage( 'file-info', $wgLang->formatSize( $file->getSize() ),
622  $file->getMimeType() )->parse();
623  }
624 
633  public static function fitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) {
634  $idealWidth = $boxWidth * $maxHeight / $boxHeight;
635  $roundedUp = ceil( $idealWidth );
636  if ( round( $roundedUp * $boxHeight / $boxWidth ) > $maxHeight ) {
637  return floor( $idealWidth );
638  } else {
639  return $roundedUp;
640  }
641  }
642 
650  return '';
651  }
652 
664  }
665 
676  function verifyUpload( $fileName ) {
677  return Status::newGood();
678  }
679 
688  function removeBadFile( $dstPath, $retval = 0 ) {
689  if ( file_exists( $dstPath ) ) {
690  $thumbstat = stat( $dstPath );
691  if ( $thumbstat['size'] == 0 || $retval != 0 ) {
692  $result = unlink( $dstPath );
693 
694  if ( $result ) {
695  wfDebugLog( 'thumbnail',
696  sprintf( 'Removing bad %d-byte thumbnail "%s". unlink() succeeded',
697  $thumbstat['size'], $dstPath ) );
698  } else {
699  wfDebugLog( 'thumbnail',
700  sprintf( 'Removing bad %d-byte thumbnail "%s". unlink() failed',
701  $thumbstat['size'], $dstPath ) );
702  }
703 
704  return true;
705  }
706  }
707 
708  return false;
709  }
710 
724  public function filterThumbnailPurgeList( &$files, $options ) {
725  // Do nothing
726  }
727 
728  /*
729  * True if the handler can rotate the media
730  * @since 1.21
731  * @return bool
732  */
733  public static function canRotate() {
734  return false;
735  }
736 
751  public function getRotation( $file ) {
752  return 0;
753  }
754 
766  protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
767  # Keep error output limited (bug 57985)
768  $errMessage = trim( substr( $err, 0, self::MAX_ERR_LOG_SIZE ) );
769 
770  wfDebugLog( 'thumbnail',
771  sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
772  wfHostname(), $retval, $errMessage, $cmd ) );
773  }
774 
782  public function getAvailableLanguages( File $file ) {
783  return array();
784  }
785 
798  public function getDefaultRenderLanguage( File $file ) {
799  return null;
800  }
801 
812  public function getLength( $file ) {
813  return 0.0;
814  }
815 }
MediaHandler\removeBadFile
removeBadFile( $dstPath, $retval=0)
Check for zero-sized thumbnails.
Definition: MediaHandler.php:688
MediaHandler\mustRender
mustRender( $file)
True if handled types cannot be displayed directly in a browser but can be rendered.
Definition: MediaHandler.php:331
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
MediaHandler\getCommonMetaArray
getCommonMetaArray(File $file)
Get an array of standard (FormatMetadata type) metadata values.
Definition: MediaHandler.php:232
MediaHandler\normaliseParams
normaliseParams( $image, &$params)
Changes the parameter array as necessary, ready for transformation.
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
MediaHandler\verifyUpload
verifyUpload( $fileName)
File validation hook called on upload.
Definition: MediaHandler.php:676
$files
$files
Definition: importImages.php:67
FormatMetadata\getFormattedData
static getFormattedData( $tags, $context=false)
Numbers given by Exif user agents are often magical, that is they should be replaced by a detailed ex...
Definition: FormatMetadata.php:79
$mime
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string $mime
Definition: hooks.txt:2573
MediaHandler\TRANSFORM_LATER
const TRANSFORM_LATER
Definition: MediaHandler.php:30
$extensions
$extensions
Definition: importImages.php:62
MediaHandler\getMetadataVersion
static getMetadataVersion()
Get metadata version.
Definition: MediaHandler.php:145
MediaHandler\filterThumbnailPurgeList
filterThumbnailPurgeList(&$files, $options)
Remove files from the purge list.
Definition: MediaHandler.php:724
MediaHandler\getEntireText
getEntireText(File $file)
Get the text of the entire document.
Definition: MediaHandler.php:441
MediaHandler\getShortDesc
getShortDesc( $file)
Used instead of getLongDesc if there is no handler registered for file.
Definition: MediaHandler.php:581
MediaHandler\MAX_ERR_LOG_SIZE
const MAX_ERR_LOG_SIZE
Max length of error logged by logErrorForExternalProcess()
Definition: MediaHandler.php:37
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1040
$ret
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition: hooks.txt:1530
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2387
MediaHandler\getThumbType
getThumbType( $ext, $mime, $params=null)
Get the thumbnail extension and MIME type for a given source MIME type.
Definition: MediaHandler.php:288
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
$params
$params
Definition: styleTest.css.php:40
wfHostname
wfHostname()
Fetch server name for use in error reporting etc.
Definition: GlobalFunctions.php:1786
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2113
MediaHandler\getLongDesc
getLongDesc( $file)
Short description.
Definition: MediaHandler.php:593
MediaHandler\getMetadataType
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
Definition: MediaHandler.php:181
MediaHandler\getPageDimensions
getPageDimensions( $image, $page)
Get an associative array of page dimensions Currently "width" and "height" are understood,...
Definition: MediaHandler.php:412
MediaHandler\getAvailableLanguages
getAvailableLanguages(File $file)
Get list of languages file can be viewed in.
Definition: MediaHandler.php:782
MediaHandler\makeParamString
makeParamString( $params)
Merge a parameter array into a string appropriate for inclusion in filenames.
MediaHandler\METADATA_COMPATIBLE
const METADATA_COMPATIBLE
Definition: MediaHandler.php:33
File
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition: File.php:50
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2417
$parser
do that in ParserLimitReportFormat instead $parser
Definition: hooks.txt:1956
MediaHandler\canRotate
static canRotate()
Definition: MediaHandler.php:733
MediaHandler\canAnimateThumbnail
canAnimateThumbnail( $file)
If the material is animated, we can animate the thumbnail.
Definition: MediaHandler.php:384
MediaHandler\getPageText
getPageText( $image, $page)
Generic getter for text layer.
Definition: MediaHandler.php:432
wfMessage
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4001
MediaHandler\addMeta
static addMeta(&$array, $visibility, $type, $id, $value, $param=false)
This is used to generate an array element for each metadata value That array is then used to generate...
Definition: MediaHandler.php:555
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
MediaHandler\formatMetadataHelper
formatMetadataHelper( $metadataArray)
sorts the visible/invisible field.
Definition: MediaHandler.php:500
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:188
MediaHandler\getImageSize
getImageSize( $image, $path)
Get an image size array like that returned by getimagesize(), or false if it can't be determined.
MediaHandler\$handlers
static $handlers
Definition: MediaHandler.php:40
MediaHandler\isEnabled
isEnabled()
False if the handler is disabled for all files.
Definition: MediaHandler.php:392
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1530
MediaHandler\getDimensionsString
getDimensionsString( $file)
Shown in file history box on image description page.
Definition: MediaHandler.php:649
MediaHandler\getMetadata
getMetadata( $image, $path)
Get handler-specific metadata which will be saved in the img_metadata field.
Definition: MediaHandler.php:126
MediaHandler\convertMetadataVersion
convertMetadataVersion( $metadata, $version=1)
Convert metadata version.
Definition: MediaHandler.php:162
MediaHandler\getGeneralShortDesc
static getGeneralShortDesc( $file)
Long description.
Definition: MediaHandler.php:606
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:933
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
MediaHandler\formatMetadata
formatMetadata( $image)
Get an array structure that looks like this:
Definition: MediaHandler.php:487
$value
$value
Definition: styleTest.css.php:45
MediaHandler\getTransform
getTransform( $image, $dstPath, $dstUrl, $params)
Get a MediaTransformOutput object representing the transformed output.
Definition: MediaHandler.php:262
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:2077
$version
$version
Definition: parserTests.php:86
MediaHandler\getStreamHeaders
getStreamHeaders( $metadata)
Get useful response headers for GET/HEAD requests for a file with the given metadata.
Definition: MediaHandler.php:310
MediaHandler\doTransform
doTransform( $image, $dstPath, $dstUrl, $params, $flags=0)
Get a MediaTransformOutput object representing the transformed output.
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
MediaHandler\visibleMetadataFields
visibleMetadataFields()
Get a list of metadata items which should be displayed when the metadata table is collapsed.
Definition: MediaHandler.php:528
$wgLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
Definition: design.txt:56
MediaHandler\getParamMap
getParamMap()
Get an associative array mapping magic word IDs to parameter names.
$ext
$ext
Definition: NoLocalSettings.php:34
MediaHandler\logErrorForExternalProcess
logErrorForExternalProcess( $retval, $err, $cmd)
Log an error that occurred in an external process.
Definition: MediaHandler.php:766
$path
$path
Definition: NoLocalSettings.php:35
MediaHandler\getHandler
static getHandler( $type)
Get a MediaHandler for a given MIME type from the instance cache.
Definition: MediaHandler.php:48
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
MediaHandler\parserTransformHook
parserTransformHook( $parser, $file)
Modify the parser object post-transform.
Definition: MediaHandler.php:663
MediaHandler\isAnimatedImage
isAnimatedImage( $file)
The material is an image, and is animated.
Definition: MediaHandler.php:373
MediaHandler\parseParamString
parseParamString( $str)
Parse a param string made with makeParamString back into an array.
MediaHandler\METADATA_BAD
const METADATA_BAD
Definition: MediaHandler.php:32
MediaHandler\canRender
canRender( $file)
True if the handled types can be transformed.
Definition: MediaHandler.php:320
MediaHandler\isVectorized
isVectorized( $file)
The material is vectorized and thus scaling is lossless.
Definition: MediaHandler.php:361
MediaHandler\getScriptedTransform
getScriptedTransform( $image, $script, $params)
Get a MediaTransformOutput object representing an alternate of the transformed output which will call...
Definition: MediaHandler.php:248
MediaHandler\getGeneralLongDesc
static getGeneralLongDesc( $file)
Used instead of getShortDesc if there is no handler registered for file.
Definition: MediaHandler.php:618
MediaHandler\fitBoxWidth
static fitBoxWidth( $boxWidth, $boxHeight, $maxHeight)
Calculate the largest thumbnail width for a given original file size such that the thumbnail's height...
Definition: MediaHandler.php:633
MediaHandler\validateParam
validateParam( $name, $value)
Validate a thumbnail parameter at parse time.
FormatMetadata\getVisibleFields
static getVisibleFields()
Get a list of fields that are visible by default.
Definition: FormatMetadata.php:1574
MediaHandler\isMetadataValid
isMetadataValid( $image, $metadata)
Check if the metadata string is valid for this handler.
Definition: MediaHandler.php:196
$retval
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
Definition: hooks.txt:237
MediaHandler\isMultiPage
isMultiPage( $file)
True if the type has multi-page capabilities.
Definition: MediaHandler.php:341
MediaHandler\getRotation
getRotation( $file)
On supporting image formats, try to read out the low-level orientation of the file and return the ang...
Definition: MediaHandler.php:751
MediaHandler
Base media handler class.
Definition: MediaHandler.php:29
MediaHandler\getLength
getLength( $file)
If its an audio file, return the length of the file.
Definition: MediaHandler.php:812
MediaHandler\METADATA_GOOD
const METADATA_GOOD
Definition: MediaHandler.php:31
MediaHandler\getDefaultRenderLanguage
getDefaultRenderLanguage(File $file)
On file types that support renderings in multiple languages, which language is used by default if uns...
Definition: MediaHandler.php:798
MediaHandler\pageCount
pageCount( $file)
Page count for a multi-page document, false if unsupported or unknown.
Definition: MediaHandler.php:351
$type
$type
Definition: testCompression.php:46