Manual:Hooks/ThumbnailBeforeProduceHTML

From MediaWiki.org
Jump to navigation Jump to search
ThumbnailBeforeProduceHTML
Available from version 1.21.0
Called before an image HTML is about to be rendered (by ThumbnailImage:toHtml method).
Define function:
public static function onThumbnailBeforeProduceHTML( ThumbnailImage $thumbnail, array &$attribs, array &$linkAttribs ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ThumbnailBeforeProduceHTML": "MyExtensionHooks::onThumbnailBeforeProduceHTML"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ThumbnailBeforeProduceHTML'][] = 'MyExtensionHooks::onThumbnailBeforeProduceHTML';
Called from:File(s): media/MediaTransformOutput.php

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

Details[edit]

  • $thumbnail: the ThumbnailImage object
  • &$attribs: image attribute array
  • &$linkAttribs: image link attribute array