Manual:Hooks/ParserMakeImageParams

From MediaWiki.org
Jump to navigation Jump to search
ParserMakeImageParams
Available from version 1.12.0
Alter the parameters used to generate an image before it is generated
Define function:
public static function onParserMakeImageParams( $title, $file, &$params, $parser ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ParserMakeImageParams": "MyExtensionHooks::onParserMakeImageParams"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ParserMakeImageParams'][] = 'MyExtensionHooks::onParserMakeImageParams';
Called from:File(s): Parser.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:ParserMakeImageParams extensions.

Details[edit]

  • $title: The title of the image
  • $file: The file name of the image
  • $params: The parameters used to generate the image (i.e. thumbnail, center, framed). See Parser.php for a complete list.
  • $parser: Parser that called the hook. Available since MediaWiki 1.20.