Help:PageImages: Difference between revisions
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
See {{Mw|article=Extension:PageImages}} for technical information on [[MediaWiki]]. | See {{Mw|article=Extension:PageImages}} for technical information on [[MediaWiki]]. | ||
==Page information== | ==Page information== | ||
[[ | [[Page information]] will returns information about images on the page, such as thumbnail and presence of photos. | ||
==How it works== | ==How it works== | ||
{{Notice|This is a technical explanation.}}When a page is saved with a local image, the [[parser]] runs the hooks <code>ParserMakeImageParams</code> and <code>LinksUpdate</code>. | {{Notice|This is a technical explanation.}}When a page is saved with a local image, the [[parser]] runs the hooks <code>ParserMakeImageParams</code> and <code>LinksUpdate</code>. |
Latest revision as of 21:16, 15 September 2024
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.
See Extension:PageImages for technical information on MediaWiki.
Page information
Page information will returns information about images on the page, such as thumbnail and presence of photos.
How it works
This is a technical explanation. |
When a page is saved with a local image, the parser runs the hooks ParserMakeImageParams
and LinksUpdate
.
The PageImages extension responds to these (and other hooks) and inserts a new property for the page into the page_props table.
The property name is page_image_free
and its value is the name of the image.
The extension only stores the chosen image name. Other features may display the image, such as Page information, Hovercards, and Mobile search while typing.
Image choice
How can I check which image is associated with a page?
Page images will be listed on the ?action=info
page.
How does it select images?
All images in the page are collected and a score for each image is calculated. The image with the highest score is selected as the page image. If the wiki is configured such that images contain metadata that specifies images are not freely licensed, the image with the best score that is also freely licensed is also stored. If no suitable image is found or all the images score badly (i.e. has a negative score), the page will not have any images.
If $wgPageImagesLeadSectionOnly is true, only images in the lead section will be considered.
How are images scored?
The best possible page image on Wikimedia wikis is one of the first four images in an article which has a width/height between 400-600px and a height/width which is twice the value of the other dimension.
- The algorithm is configurable.
- Scores are calculated by a combination of:
- Image widths as defined in Template:Phpi
- In Wikimedia wikis, images smaller than 119 pixels are weighted highly negatively. Images with widths between 400px-600px are favored, with a preference for the lower bound.
- Images inside galleries are scored separately using Template:Phpi
- In Wikimedia wikis gallery images which are smaller than 100 are disregarded.
- Position in document is also considered as defined in Template:Phpi
- On Wikimedia wikis, only the first 4 images that appear in the document are considered.
- The ratio of the image's width to height is considered Template:Phpi
- On Wikimedia wikis a ratio of 0.4 to 3.1 is allowed, with 0.6 to 2.1 preferred. Any other images will score negatively and be discarded.
- Image widths as defined in Template:Phpi
Be more technical, please...
Pageimages populates images whenever the LinksUpdate hook runs.
In PageImages this is executed in LinksUpdateHookHandler::doLinksUpdate
Can I exclude certain page images?
Yes! There is a list on every wiki that administrators can edit, at MediaWiki:Pageimages-denylist (MediaWiki:Pageimages-denylist example). Any images that appear here will not be page images for any article. Please leave a comment at MediaWiki talk:Pageimages-denylist to have a file to the list.
What about just for one particular article?
Sadly not at the current time. Please use the denylist or move the image outside the lead section.
How can I purge a bad image?
The pageimage only changes when a link in an article changes. For emergencies, please add/remove links from the page, reverting if necessary.
Purging will not work.
Why is my page image a blank box?
This likely relates to video content in your article.
If a video file begins with a blank screen, that will become the default thumbnail for the video and if used as the page image, it will become the page image.
We are currently working on a fix for this, that will allow you to change the default thumbnail of a video.