MediaWiki  master
MediaHandler.php
Go to the documentation of this file.
1 <?php
24 
30 abstract class MediaHandler {
31  const TRANSFORM_LATER = 1;
32  const METADATA_GOOD = true;
33  const METADATA_BAD = false;
34  const METADATA_COMPATIBLE = 2; // for old but backwards compatible.
38  const MAX_ERR_LOG_SIZE = 65535;
39 
46  static function getHandler( $type ) {
47  return MediaWikiServices::getInstance()
48  ->getMediaHandlerFactory()->getHandler( $type );
49  }
50 
55  abstract public function getParamMap();
56 
65  abstract public function validateParam( $name, $value );
66 
73  abstract public function makeParamString( $params );
74 
81  abstract public function parseParamString( $str );
82 
90  abstract function normaliseParams( $image, &$params );
91 
112  abstract function getImageSize( $image, $path );
113 
122  function getMetadata( $image, $path ) {
123  return '';
124  }
125 
141  static function getMetadataVersion() {
142  $version = [ '2' ]; // core metadata version
143  Hooks::run( 'GetMetadataVersion', [ &$version ] );
144 
145  return implode( ';', $version );
146  }
147 
158  function convertMetadataVersion( $metadata, $version = 1 ) {
159  if ( !is_array( $metadata ) ) {
160  // unserialize to keep return parameter consistent.
161  Wikimedia\suppressWarnings();
162  $ret = unserialize( $metadata );
163  Wikimedia\restoreWarnings();
164 
165  return $ret;
166  }
167 
168  return $metadata;
169  }
170 
178  function getMetadataType( $image ) {
179  return false;
180  }
181 
198  function isMetadataValid( $image, $metadata ) {
199  return self::METADATA_GOOD;
200  }
201 
234  public function getCommonMetaArray( File $file ) {
235  return false;
236  }
237 
250  function getScriptedTransform( $image, $script, $params ) {
251  return false;
252  }
253 
264  final function getTransform( $image, $dstPath, $dstUrl, $params ) {
265  return $this->doTransform( $image, $dstPath, $dstUrl, $params, self::TRANSFORM_LATER );
266  }
267 
280  abstract function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 );
281 
290  function getThumbType( $ext, $mime, $params = null ) {
291  $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
292  if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) {
293  // The extension is not valid for this MIME type and we do
294  // recognize the MIME type
295  $extensions = $magic->getExtensionsForType( $mime );
296  if ( $extensions ) {
297  return [ strtok( $extensions, ' ' ), $mime ];
298  }
299  }
300 
301  // The extension is correct (true) or the MIME type is unknown to
302  // MediaWiki (null)
303  return [ $ext, $mime ];
304  }
305 
312  public function canRender( $file ) {
313  return true;
314  }
315 
323  public function mustRender( $file ) {
324  return false;
325  }
326 
333  public function isMultiPage( $file ) {
334  return false;
335  }
336 
343  function pageCount( File $file ) {
344  return false;
345  }
346 
353  function isVectorized( $file ) {
354  return false;
355  }
356 
365  function isAnimatedImage( $file ) {
366  return false;
367  }
368 
376  function canAnimateThumbnail( $file ) {
377  return true;
378  }
379 
384  function isEnabled() {
385  return true;
386  }
387 
404  function getPageDimensions( File $image, $page ) {
405  $gis = $this->getImageSize( $image, $image->getLocalRefPath() );
406  if ( $gis ) {
407  return [
408  'width' => $gis[0],
409  'height' => $gis[1]
410  ];
411  } else {
412  return false;
413  }
414  }
415 
424  function getPageText( File $image, $page ) {
425  return false;
426  }
427 
433  public function getEntireText( File $file ) {
434  $numPages = $file->pageCount();
435  if ( !$numPages ) {
436  // Not a multipage document
437  return $this->getPageText( $file, 1 );
438  }
439  $document = '';
440  for ( $i = 1; $i <= $numPages; $i++ ) {
441  $curPage = $this->getPageText( $file, $i );
442  if ( is_string( $curPage ) ) {
443  $document .= $curPage . "\n";
444  }
445  }
446  if ( $document !== '' ) {
447  return $document;
448  }
449  return false;
450  }
451 
480  function formatMetadata( $image, $context = false ) {
481  return false;
482  }
483 
494  function formatMetadataHelper( $metadataArray, $context = false ) {
495  $result = [
496  'visible' => [],
497  'collapsed' => []
498  ];
499 
500  $formatted = FormatMetadata::getFormattedData( $metadataArray, $context );
501  // Sort fields into visible and collapsed
502  $visibleFields = $this->visibleMetadataFields();
503  foreach ( $formatted as $name => $value ) {
504  $tag = strtolower( $name );
505  self::addMeta( $result,
506  in_array( $tag, $visibleFields ) ? 'visible' : 'collapsed',
507  'exif',
508  $tag,
509  $value
510  );
511  }
512 
513  return $result;
514  }
515 
522  protected function visibleMetadataFields() {
524  }
525 
549  protected static function addMeta( &$array, $visibility, $type, $id, $value, $param = false ) {
550  $msg = wfMessage( "$type-$id", $param );
551  if ( $msg->exists() ) {
552  $name = $msg->text();
553  } else {
554  // This is for future compatibility when using instant commons.
555  // So as to not display as ugly a name if a new metadata
556  // property is defined that we don't know about
557  // (not a major issue since such a property would be collapsed
558  // by default).
559  wfDebug( __METHOD__ . ' Unknown metadata name: ' . $id . "\n" );
560  $name = wfEscapeWikiText( $id );
561  }
562  $array[$visibility][] = [
563  'id' => "$type-$id",
564  'name' => $name,
565  'value' => $value
566  ];
567  }
568 
575  function getShortDesc( $file ) {
576  return self::getGeneralShortDesc( $file );
577  }
578 
585  function getLongDesc( $file ) {
586  return self::getGeneralLongDesc( $file );
587  }
588 
595  static function getGeneralShortDesc( $file ) {
596  global $wgLang;
597 
598  return htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
599  }
600 
607  static function getGeneralLongDesc( $file ) {
608  return wfMessage( 'file-info' )->sizeParams( $file->getSize() )
609  ->params( '<span class="mime-type">' . $file->getMimeType() . '</span>' )->parse();
610  }
611 
620  public static function fitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) {
621  $idealWidth = $boxWidth * $maxHeight / $boxHeight;
622  $roundedUp = ceil( $idealWidth );
623  if ( round( $roundedUp * $boxHeight / $boxWidth ) > $maxHeight ) {
624  return floor( $idealWidth );
625  } else {
626  return $roundedUp;
627  }
628  }
629 
636  function getDimensionsString( $file ) {
637  return '';
638  }
639 
650  function parserTransformHook( $parser, $file ) {
651  }
652 
663  function verifyUpload( $fileName ) {
664  return Status::newGood();
665  }
666 
675  function removeBadFile( $dstPath, $retval = 0 ) {
676  if ( file_exists( $dstPath ) ) {
677  $thumbstat = stat( $dstPath );
678  if ( $thumbstat['size'] == 0 || $retval != 0 ) {
679  $result = unlink( $dstPath );
680 
681  if ( $result ) {
682  wfDebugLog( 'thumbnail',
683  sprintf( 'Removing bad %d-byte thumbnail "%s". unlink() succeeded',
684  $thumbstat['size'], $dstPath ) );
685  } else {
686  wfDebugLog( 'thumbnail',
687  sprintf( 'Removing bad %d-byte thumbnail "%s". unlink() failed',
688  $thumbstat['size'], $dstPath ) );
689  }
690 
691  return true;
692  }
693  }
694 
695  return false;
696  }
697 
711  public function filterThumbnailPurgeList( &$files, $options ) {
712  // Do nothing
713  }
714 
720  public function canRotate() {
721  return false;
722  }
723 
738  public function getRotation( $file ) {
739  return 0;
740  }
741 
753  protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
754  # Keep error output limited (T59985)
755  $errMessage = trim( substr( $err, 0, self::MAX_ERR_LOG_SIZE ) );
756 
757  wfDebugLog( 'thumbnail',
758  sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
759  wfHostname(), $retval, $errMessage, $cmd ) );
760  }
761 
769  public function getAvailableLanguages( File $file ) {
770  return [];
771  }
772 
782  public function getMatchedLanguage( $userPreferredLanguage, array $availableLanguages ) {
783  return null;
784  }
785 
798  public function getDefaultRenderLanguage( File $file ) {
799  return null;
800  }
801 
812  public function getLength( $file ) {
813  return 0.0;
814  }
815 
821  public function isExpensiveToThumbnail( $file ) {
822  return false;
823  }
824 
831  public function supportsBucketing() {
832  return false;
833  }
834 
841  public function sanitizeParamsForBucketing( $params ) {
842  return $params;
843  }
844 
870  public function getWarningConfig( $file ) {
871  return null;
872  }
873 
881  public static function getPageRangesByDimensions( $pagesByDimensions ) {
882  $pageRangesByDimensions = [];
883 
884  foreach ( $pagesByDimensions as $dimensions => $pageList ) {
885  $ranges = [];
886  $firstPage = $pageList[0];
887  $lastPage = $firstPage - 1;
888 
889  foreach ( $pageList as $page ) {
890  if ( $page > $lastPage + 1 ) {
891  if ( $firstPage != $lastPage ) {
892  $ranges[] = "$firstPage-$lastPage";
893  } else {
894  $ranges[] = "$firstPage";
895  }
896 
897  $firstPage = $page;
898  }
899 
900  $lastPage = $page;
901  }
902 
903  if ( $firstPage != $lastPage ) {
904  $ranges[] = "$firstPage-$lastPage";
905  } else {
906  $ranges[] = "$firstPage";
907  }
908 
909  $pageRangesByDimensions[ $dimensions ] = $ranges;
910  }
911 
912  $dimensionsString = [];
913  foreach ( $pageRangesByDimensions as $dimensions => $pageRanges ) {
914  $dimensionsString[] = "$dimensions:" . implode( ',', $pageRanges );
915  }
916 
917  return implode( '/', $dimensionsString );
918  }
919 
926  public function getContentHeaders( $metadata ) {
927  return [ 'X-Content-Dimensions' => '' ]; // T175689
928  }
929 }
convertMetadataVersion( $metadata, $version=1)
Convert metadata version.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
static getPageRangesByDimensions( $pagesByDimensions)
Converts a dimensions array about a potentially multipage document from an exhaustive list of ordered...
getLocalRefPath()
Get an FS copy or original of this file and return the path.
Definition: File.php:433
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
getMatchedLanguage( $userPreferredLanguage, array $availableLanguages)
When overridden in a descendant class, returns a language code most suiting.
removeBadFile( $dstPath, $retval=0)
Check for zero-sized thumbnails.
static getFormattedData( $tags, $context=false)
Numbers given by Exif user agents are often magical, that is they should be replaced by a detailed ex...
getShortDesc( $file)
Short description.
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
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:1996
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static getMetadataVersion()
Get metadata version.
getTransform( $image, $dstPath, $dstUrl, $params)
Get a MediaTransformOutput object representing the transformed output.
wfHostname()
Fetch server name for use in error reporting etc.
makeParamString( $params)
Merge a parameter array into a string appropriate for inclusion in filenames.
validateParam( $name, $value)
Validate a thumbnail parameter at parse time.
isExpensiveToThumbnail( $file)
True if creating thumbnails from the file is large or otherwise resource-intensive.
$value
getPageText(File $image, $page)
Generic getter for text layer.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
const TRANSFORM_LATER
isMultiPage( $file)
True if the type has multi-page capabilities.
const METADATA_BAD
formatMetadata( $image, $context=false)
Get an array structure that looks like this:
static getInstance()
Returns the global default instance of the top level service locator.
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition: hooks.txt:1813
static fitBoxWidth( $boxWidth, $boxHeight, $maxHeight)
Calculate the largest thumbnail width for a given original file size such that the thumbnail&#39;s height...
sanitizeParamsForBucketing( $params)
Returns a normalised params array for which parameters have been cleaned up for bucketing purposes...
static getGeneralShortDesc( $file)
Used instead of getShortDesc if there is no handler registered for file.
static getVisibleFields()
Get a list of fields that are visible by default.
isVectorized( $file)
The material is vectorized and thus scaling is lossless.
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. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. '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 '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 '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 '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. '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 IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() '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 Sanitizer::validateEmail(), 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 '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:Array with elements of the form "language:title" in the order that they will be output. & $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. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. 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:1994
getDefaultRenderLanguage(File $file)
On file types that support renderings in multiple languages, which language is used by default if uns...
const MAX_ERR_LOG_SIZE
Max length of error logged by logErrorForExternalProcess()
getEntireText(File $file)
Get the text of the entire document.
if( $ext=='php'|| $ext=='php5') $mime
Definition: router.php:59
$wgLang
Definition: Setup.php:902
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead 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
isAnimatedImage( $file)
The material is an image, and is animated.
getThumbType( $ext, $mime, $params=null)
Get the thumbnail extension and MIME type for a given source MIME type.
getMetadata( $image, $path)
Get handler-specific metadata which will be saved in the img_metadata field.
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:81
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
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...
getRotation( $file)
On supporting image formats, try to read out the low-level orientation of the file and return the ang...
$params
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:1996
getAvailableLanguages(File $file)
Get list of languages file can be viewed in.
unserialize( $serialized)
parserTransformHook( $parser, $file)
Modify the parser object post-transform.
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
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
getScriptedTransform( $image, $script, $params)
Get a MediaTransformOutput object representing an alternate of the transformed output which will call...
getParamMap()
Get an associative array mapping magic word IDs to parameter names.
getDimensionsString( $file)
Shown in file history box on image description page.
const METADATA_GOOD
canAnimateThumbnail( $file)
If the material is animated, we can animate the thumbnail.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
isMetadataValid( $image, $metadata)
Check if the metadata string is valid for this handler.
verifyUpload( $fileName)
File validation hook called on upload.
getWarningConfig( $file)
Gets configuration for the file warning message.
getImageSize( $image, $path)
Get an image size array like that returned by getimagesize(), or false if it can&#39;t be determined...
getContentHeaders( $metadata)
Get useful response headers for GET/HEAD requests for a file with the given metadata.
getLength( $file)
If its an audio file, return the length of the file.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
logErrorForExternalProcess( $retval, $err, $cmd)
Log an error that occurred in an external process.
parseParamString( $str)
Parse a param string made with makeParamString back into an array.
filterThumbnailPurgeList(&$files, $options)
Remove files from the purge list.
normaliseParams( $image, &$params)
Changes the parameter array as necessary, ready for transformation.
mustRender( $file)
True if handled types cannot be displayed directly in a browser but can be rendered.
static getGeneralLongDesc( $file)
Used instead of getLongDesc if there is no handler registered for file.
const METADATA_COMPATIBLE
visibleMetadataFields()
Get a list of metadata items which should be displayed when the metadata table is collapsed...
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition: hooks.txt:2626
getPageDimensions(File $image, $page)
Get an associative array of page dimensions Currently "width" and "height" are understood, but this might be expanded in the future.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check $image
Definition: hooks.txt:785
isEnabled()
False if the handler is disabled for all files.
doTransform( $image, $dstPath, $dstUrl, $params, $flags=0)
Get a MediaTransformOutput object representing the transformed output.
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:276
canRender( $file)
True if the handled types can be transformed.
canRotate()
True if the handler can rotate the media.
pageCount()
Returns the number of pages of a multipage document, or false for documents which aren&#39;t multipage do...
Definition: File.php:1989
Base media handler class.
formatMetadataHelper( $metadataArray, $context=false)
sorts the visible/invisible field.
getCommonMetaArray(File $file)
Get an array of standard (FormatMetadata type) metadata values.
getLongDesc( $file)
Long description.
supportsBucketing()
Returns whether or not this handler supports the chained generation of thumbnails according to bucket...
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition: File.php:51
static getHandler( $type)
Get a MediaHandler for a given MIME type from the instance cache.
$ext
Definition: router.php:55
pageCount(File $file)
Page count for a multi-page document, false if unsupported or unknown.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200