Extension:PageImages

The PageImages extension collects information about images used on a page.

Its aim is to return the single most appropriate thumbnail associated with an article, attempting to return only meaningful images, e.g. not those from maintenance templates, stubs or flag icons. Currently it uses the first non-meaningless image used in the page.

API
Page images information is exposed via a new prop=pageimages API.

Parameters:
 * piprop: What information about the page images to return (can be one or more values, pipe-delimited):
 * thumbnail - URL of image thumbnail.
 * name - Image title.


 * pithumbsize: Width of thumbnail in pixels. If omitted a default of 50px will be used.
 * pilimit: Number of pages to process.
 * picontinue: If more imformation is available, use this parameter to request it.

Example: /w/api.php?action=query&prop=pageimages&titles=Somepage&format=json

/w/api.php?action=query&prop=pageimages&titles=Somepage&format=xml

Configuration
$wgPageImagesBlacklist is an array of sources for image blacklists. Blacklisted images will never be selected as page images. Examples: More than one source can be used at the same time.

$wgPageImagesBlacklistExpiry determines how long the blacklist will remain cached, in seconds. Default: 15 * 60 (15 minutes).

$wgPageImagesExpandOpenSearchXml if set to true, PageImages will override Extension:OpenSearchXml's image detection with its own, more accurate results. Default: false.

$wgPageImagesNamespaces is an array of namespaces PageImages will be activated on. Default: NS_MAIN.

How it works
On a page is saved with a local image, 2 hooks onParserMakeImageParams and onLinksUpdate are called to insert a new property for the page (page_props). The prop_name is page_image and the value is the name of the image