Extension talk:PageImages

About this board

class=notpageimage not working for my case

5
Carloposo (talkcontribs)

Hello,

I added class=notpageimage to all the images inside an infobox, as I want the Previews extension to show images picked from the body of the page. The infobox contains Cargo fields.

Nonetheless, PageImages keeps on pulling images from the Infobox.

I am using MW 1.37.2, Cargo 3.2.

Thanks!

Ciencia Al Poder (talkcontribs)

This is included in REL1_38 or master branch of this extension.

Carloposo (talkcontribs)

Thanks

Carloposo (talkcontribs)

Hello, I updated to MW1.38.1 but still not working for me.

Any idea?

Thank you in advance.

Carlo

Carloposo (talkcontribs)

My bad, it's working now. Forgot to run initImageData.php

transcluding the blacklist

3
Summary by Xaosflux

This is not supported

Xaosflux (talkcontribs)

@MaxSem: over on enwiki we have a request that someone would like to transclude in the MediaWiki:Bad image list to the MediaWiki:Pageimages-denylist.

(a) Are transclusions supported on this page for this extension? (b) Any issues with the transcluded page being in the BIL format (e.g. containing those "except on" type clauses)

MaxSem (talkcontribs)

No, transclusion doesn't work here.

Xaosflux (talkcontribs)

Thank you.

8.41.6.110 (talkcontribs)

How can I specify a default image for entire wiki when there is no image on the page?

Lens0021 (talkcontribs)

You could set $wgPageImagesOpenGraphFallbackImage if the version of your MediaWiki is 1.37 or later.

$wgPageImagesOpenGraphFallbackImage = "/resources/logo.png";
Reply to "default image for og:image"

Images included by transcluded template

2
EvilPastaSalad (talkcontribs)

Does PageImages ignore or somehow miss images that are included in a page through translusion via a template?

I've adjusted the "ratio" scores in extension.json such that the ratios of image sizes I normally have are scored positively. But with that update, after re-saving the page, I still can't get &action=info to show me any "page image" property on many of my pages, on pages using templates to write infoboxes, the same the way I can when images are simply included using normal Wikitext.

Is using a template to write the image to the page my problem? Thoughts? Workarounds? Thanks.

Ciencia Al Poder (talkcontribs)

Images included through transclusion of templates work fine for PageImages.

Reply to "Images included by transcluded template"

No images shown in Project namespace

3
Felix Englisch (talkcontribs)

I enabled the popups for pages in the Project namespace with $wgContentNamespaces = [ NS_MAIN, NS_PROJECT, NS_CATEGORY, NS_USER ]; in my LocalSettings.php. The popups are working indeed, but without any images. The parameter "Page image" is also missing in the page information table of articles in the Project namespace (even if an image is inserted which triggers the popup on normal articles).

It isn't quite urgent, but I'd like popups with images to be shown also for those articles. Does anyone know a solution? Thanks in advance!

PrimeHunter (talkcontribs)
Ciencia Al Poder (talkcontribs)

You'd have to set $wgPageImagesNamespaces accordingly, since it defaults to NS_MAIN.

After the change, you'll have to run refreshLinks.php to generate the Page image information for those namespaces (hopefully, you can use the --namespace parameter to process only pages on the affected namespaces, since that script is very resource-intensive)

Reply to "No images shown in Project namespace"
46.211.56.121 (talkcontribs)

Don't displayed images from infoboxes, please hepl to fix this.

217.92.248.228 (talkcontribs)

in extension.json try higher numbers for the first position --> in config --> PageImagesScores -> value -> position.


i want the images of infoboxes to be a page image and it seems working well with these settings:


               "position": [

                   100,

                   -100,

                   -100,

                   -100

               ],

195.138.93.32 (talkcontribs)

Its work, but I use PortableInfobox, and PageImages chose images from templates in infobox, but not the main image. How fix it?

Reply to "images from infoboxes"
Vishkujo (talkcontribs)

I would like to make the extension take the first image in the page by default.

Ciencia Al Poder (talkcontribs)

Set $wgPageImagesScores['position'] = [ 9999, 6, 4, 3 ];

You'll have to make an edit to the page to recalculate the algorithm, and if it works, run refreshLinks.php to update all pages.

Vishkujo (talkcontribs)

Thanks, it worked.

page_image vs. page_image_free

3
Bdijkstra (talkcontribs)

What to do with pages that still have the 'page_image' property with a free (Commons) image as its value?

Ciencia Al Poder (talkcontribs)

What problem are you trying to solve?

Bdijkstra (talkcontribs)

No real problem, just improving the quality and consistency of the database, and therefore make it is easier to use.

E.g. nlwiki-20190801-page_props has one page with both page_image and page_image_free and four pages with just page_image (all pointing to Commons images). Most of these have page_links_updated > 2019-04, so I would have expected these old properties to have been cleaned up.

Reply to "page_image vs. page_image_free"
Summary by Sokote zaman

tanks

Sokote zaman (talkcontribs)

Warning: array_flip(): Can only flip STRING and INTEGER values! in /home/wikicod/domains/wikicod.ir/public_html/w/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 124

Sokote zaman (talkcontribs)

wfLoadExtension( 'PageImages' );

$wgPageImagesBlacklist = array(

// Page on local wiki

array(

'type' => 'db',

'page' => 'MediaWiki:Pageimages-blacklist',

'db' => false,

),

);

$wgPageImagesBlacklistExpiry = "15 * 60";

$wgPageImagesExpandOpenSearchXml = false;

$wgPageImagesNamespaces[NS_MAIN] = true;

Ciencia Al Poder (talkcontribs)

What mediawiki version is this?

5.117.254.150 (talkcontribs)

tankyou

V1. 33

Ciencia Al Poder (talkcontribs)

This is a problem of how you have configured the $wgPageImagesNamespaces variable in LocalSettings.php. Please review it

Sokote zaman (talkcontribs)

Is this configuration correct?

$wgPageImagesNamespaces = [NS_MAIN];

Ciencia Al Poder (talkcontribs)
9cfilorux (talkcontribs)

I installed the 1.31 release of this extension on MediaWiki 1.31. It doesn't seem to extract images for any pages. I ran initImageData.php, I edited a page with an image, I purged the page, I added an image to another page, I restarted Apache, and I restarted MariaDB (not necessarily in that order). None of that did anything. I tried using the 1.32 release instead, but when I ran its version of initImageData.php it just gave me an unending stream of this: "PHP Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /var/www/html/w/includes/media/FormatMetadata.php on line 1864". I don't know what that means. I tried the suggestion below to replace a line in LinksUpdateHookHandler.php, but that made initImageData.php refuse to run, claiming "Class 'PageImages\Hooks\Revision' not found". What's going on? Something really obvious I'm missing??

Edit: I just tried restarting Nginx and Varnish as well, since I'm using the Apache-Varnish-Nginx system Wikipedia has. No luck there either.

Ciencia Al Poder (talkcontribs)

You can't expect an extension for MediaWiki 1.32 to work on MediaWiki 1.31. Besides that, on 1.31 should work just fine. Maybe your image is very small for this extension to take into account. The image should be (depending on the configuration) at the leading section (section 0).

9cfilorux (talkcontribs)

Well, apparently so... but Special:ExtensionDistributor advises that "Most extensions work across multiple versions of MediaWiki, so if your MediaWiki version is not here, or if you have a need for the latest extension features, try using the current version.", so I thought the 1.32 version was worth a try. I considered using an even more advanced release, but that would probably have been even worse.

Extension:PageImages#How are images scored? talks about how images are scored relative to each other, including size, but it only discusses scoring of exact sizes (and aspect ratios) on Wikimedia projects. It does not say what the default settings are. As for the lead section, Extension:PageImages#How does it select images? says "If $wgPageImagesLeadSectionOnly is true, only images in the lead section will be considered. Currently it is true for only Wikipedia projects, all other projects can pull images from outside the lead."

Because the default settings are not described, I looked at the source code, making sure I had the 1.31 branch because that's what I'm currently running. (I have not configured any custom settings.) The extension.json file appears to contain the default values for $wgPageImagesScores and $wgPageImagesLeadSectionOnly. The default for the latter is true. The default for the former is:

		"PageImagesScores": {
			"value": {
				"position": [
					8,
					6,
					4,
					3
				],
				"width": {
					"@doc119": "Very small images are usually from maintenace or stub templates",
					"119": -100,
					"400": 10,
					"@doc600@": "Larger images are panoramas, less suitable",
					"600": 5,
					"601": 0
				},
				"galleryImageWidth": {
					"99": -100,
					"100": 0
				},
				"ratio": {
					"3": -100,
					"5": 0,
					"20": 5,
					"30": 0,
					"31": -100
				}
			}
		},

This means that "images smaller than 119 pixels are weighted highly negatively" is actually the default behavior, not just the setting for Wikimedia projects. I do not understand what is meant by the settings for "position" (weights for the first four images?) and "ratio". Surely "20" doesn't mean that width divided by height = 20 (e.g. 20:1). However, I would expect that "only the first 4 images that appear in the document are considered" and "the best possible images are images where the height is half the width or the height is double the width. Any images for which the ratio is less than 0.5 will score negatively and be discarded" also describe the default behavior.

The main page on my wiki looks like this (the rest is private). It has no sections and one image. This image was an unsized (defaulting to 300px, as I haven't set $wgThumbLimits to anything else) thumbnail of a 400x400 image. I uploaded two test images and tried putting them on the main page instead of that image: one that is 400x800, and another that is 400x200, in keeping with the statement that a 2:1 or 1:2 image is best. These were both also unsized thumbnails. API queries with prop=pageimages continued to return no image information for Main Page. I also found that the database query select * from page_props where pp_propname = 'page_image'; returns nothing.

It appears that PageImages is simply not finding any images. I'd like some advice on why this could be the case.

9cfilorux (talkcontribs)

It turns out the problem was I had PHP 7.3, which MediaWiki isn't fully compatible with. Now that I've downgraded to 7.2, PageImages works. Maybe this could be mentioned in the documentation.

Reply to "Does not work"
Return to "PageImages" page.