Jump to content

Extension talk:PageImages/Flow export

Add topic
From mediawiki.org
Latest comment: 1 year ago by Mayuxi in topic images from infoboxes


Still experimental?

[edit]

Since the extension is now running on the English Wikipedia, surely it is not “experimental” anymore? Mormegil (talk) 09:40, 1 February 2013 (UTC)Reply

I've no idea: currently looks like a test still, but things may change soon.[1] Nemo 10:52, 2 February 2013 (UTC)Reply
It hasn't been officially announced yet, so I still consider it experimental. The population script is running for a second week now, will probably complete in several days - we will see if it can be announced then. Max Semenik (talk) 21:50, 10 February 2013 (UTC)Reply

Open Graph image?

[edit]
So, is there any chance for including Open Graph in the page itself?
<meta property="og:image" content="http://example.com/w/images/thumb/7/70/Example.png/48px-Example.png" />
I hope so. Geraki (talk) 18:09, 9 February 2013 (UTC)Reply
Frankly, I'm a bit wary of adding more cruft to page HTML. Is there a demand for this? Max Semenik (talk) 13:23, 11 February 2013 (UTC)Reply
If that's really used by Facebook I must say that I hate it, but from a MediaWiki/Wikimedia perspective making pages look better when linked on it seems enough of a good reason. Nemo 16:08, 11 February 2013 (UTC)Reply
It seems essential if we prefer that links to Wiki[pm]edia pages are presented with an appropriate thumbnail instead of the mediawiki logo or 'featured article' sign.
In fact it will be helpful not only to wikipedia but to every wiki, so at least there should be an option to enable/disable it. Geraki (talk) 19:27, 19 February 2013 (UTC)Reply
The Open Graph Extension adds an image for og:image, using the MainImage of $out (mMainImage). Maybe the developer can use the Image of pageImages, that is much better as the first main Image on page :) Florianschmidtwelzow (talk) 16:31, 9 April 2014 (UTC)Reply
Yes, we've seen quite a demand for this lately and it would be nice. Nemo 09:09, 10 April 2014 (UTC)Reply
Hi, have you found a solution to including the og:image property? hollosch (talk) 21:52, 10 March 2013 (UTC)Reply
Just came across this. You can add an og:image to your site by the following code in your LocalSettings.php:
$wgHooks['BeforePageDisplay'][] ='MyFunction';
function MyFunction(&$out, &$skin) {
    $script = "<meta property='og:image' content='/pics/YourPic.png'>";
    $out->addHeadItem("My script", $script);
    return true;
};
Be aware that this will set YourPic.png as og:image in all of your pages.
If you want to set og:image only on your Main page see User:Stefahn/Docu#Get_the_title_of_a_page. Stefahn (talk) 08:46, 25 March 2018 (UTC)Reply
How do I refresh the page to see the meta property change in LocalSettings.php to know if it's working?
This page will inspect the url for og: metadata:
https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Fchuckipedia.ca%2Findex.php%2FCategory%3ATips Chuck.Kahn (talk) 23:52, 14 January 2023 (UTC)Reply

Missing images

[edit]

I have a question, can this extension (that is, its data) help list articles that are without images but have one in another language, in a way sufficiently reliable to (semi?)automatically insert such image suggestions to the pages? Nemo 12:25, 4 May 2013 (UTC)Reply

Maps and other images to exclude

[edit]

I think this question belongs to this extension:

Hello Nemo! I have replaced the template Koord in order to have the system you said with module:coordinates. It's working properly. But... if I check the system with Special:Nearby, it seems that it takes the location map image as a real image for the article, and it doesn't appear the "add image" symbol. Is it possible to make some images not to appear in the mobile device? -Theklan (talk) 20:35, 10 June 2013 (UTC)

I'm afraid the answer is still "no"? Nemo 07:58, 11 June 2013 (UTC)Reply

Most appropriate thumbnail / Black list

[edit]

I have two questions.

  1. Is it possible to explain the procedure to find the most appropriate thumbnail. In our test with images of a high width/height ratio like DeirMuniraOutside.jpg these images are not found and we do not know why.
  2. Is is possible to use wildcard in the Images black list like File:*.svg? RolandUnger (talk) 10:07, 17 May 2014 (UTC)Reply

Doesn't work with generators?

[edit]

I'm rather new to wikimedia API, but it appears to me that the other property queries can be used with generators, but pageimages does not work in this way.

For example, this query just gives the basic info - it does not add the pageimages data: http://en.wikipedia.org/w/api.php?action=query&prop=pageimages&generator=categorymembers&gcmtitle=Category:Culture

If I try 'pageprops' instead of 'pageimages' it works fine. Also, I think I saw a case where pageimages worked correctly for the first page in the generated list but I can't reproduce that now.

Otherwise I think the pageimages extension is great - a very valuable addition to wikimedia API! Tom2394 (talk) 17:34, 3 June 2014 (UTC)Reply

You need to set the pilimit to maximum. Try http://en.wikipedia.org/w/api.php?action=query&prop=pageimages&generator=categorymembers&gcmtitle=Category:Culture&pilimit=50 -- Bergi (talk) 07:06, 16 July 2014 (UTC)Reply

Wrong image

[edit]

Why does it show the second image on w:pt:Fursuit? (asked on w:pt:WP:Tire suas dúvidas#Como é escolhida a "Page image"? Tem como altera-la?) Helder 12:50, 24 October 2014 (UTC)Reply

Because it considers an image of this width and dimensions a panorama. Max Semenik (talk) 20:31, 24 October 2014 (UTC)Reply
I changed all the pictures of the article. Now, the first and second have the same size, but still the second image is selected. Keplerbr (talk) 01:34, 27 October 2014 (UTC)Reply
Max, please could you add more details to the docs, explaining (1) how exactly an image is selected by default? and (2) (if it's possible) how other extensions can tweak this criteria?
At the moment, the page just says: "Currently it uses the first non-meaningless image used in the page."
You've commented above and at bugzilla that there is a scoring algorithm involved, that involves image-dimensions. But beyond that I'm unsure how it works. Thanks! Quiddity (WMF) (talk) 21:22, 18 November 2014 (UTC)Reply
I'm interested too, as new features are being built to extract images and I'm never sure how they (don't) interact with PageImages and why. http://thread.gmane.org/gmane.org.wikimedia.mobile/3164 Nemo 08:03, 19 November 2014 (UTC)Reply
Please, can you explain how image is selected? I encountered some problems ( https://pl.wikipedia.org/w/index.php?title=Wikipedia%3AKawiarenka%2FKwestie_techniczne&type=revision&diff=43820326&oldid=43820129 ) and I have no idea how to fix them. Mateusz Konieczny (talk) 14:46, 13 October 2015 (UTC)Reply

Can't find constant API base

[edit]

Getting a php error:

PageImages/ ApiQueryPageImages.php on line 152 -- can't find constant api base::PARAM HELP MSG.

Since I just found this problem with TextExtracts I assume the fix they found there will fix it here.See: https://www.mediawiki.org/wiki/Extension_talk:TextExtracts Christharp (talk) 23:35, 23 December 2014 (UTC)Reply

Filed gerrit:181778, thanks. Ricordisamoa 03:17, 25 December 2014 (UTC)Reply

Proposed use of Wikidata P18

[edit]

I just wanted to highlight the proposal https://phabricator.wikimedia.org/T95026 that would allow https://www.wikidata.org/wiki/Property:P18 to specify the preferred PageImage. A qualifier could be used for items of the list of images, to possibly choose for specific use cases. I think that would be great and much needed. Aeroid (talk) 12:02, 20 August 2015 (UTC)Reply

Doesn't work with both template and wiki family.

[edit]

I want to get a source of a image in template. When I use this "/api.php?action=query&prop=pageimages&format=json&piprop=thumbnail&pithumbsize=528&titles=<page title>" API URL, it doesn't get the source of the image. But when I added "&generator=images" the end of the API URL, it works.

Our site is working as wiki family of 3 languages(uz, en and ru). All images are uploaded to only uz domain and all 3 domains will share the image. I want to use this API("/api.php?action=query&prop=pageimages&format=json&piprop=thumbnail&pithumbsize=528&titles=<page title>&generator=images") at en domain to find a source of a image which is located physically in uz domain. This API works at uz domin. But I used this API to get a source of a image in template at en domain, it doesn't work.  The Wiki version is 1.24 and the extension is also for the Wiki version.  213.230.84.59 (talk) 19:30, 15 September 2015 (UTC)Reply

What exactly does it do besides API?

[edit]
  • Will it add a meta page image tag? I see old discussion but no answers.
It does nothing but the API. Max Semenik (talk) 06:28, 25 February 2016 (UTC)Reply

Image choice

[edit]

I have added an "Image choice" section.[2] Please correct or add if you know more. phab:T141967 was created today with a suggestion to let editors choose the image. PrimeHunter (talk) 15:40, 3 August 2016 (UTC)Reply

Thanks @PrimeHunter, the image selected isn't the main, and most indicative image, because the image related to the article is licensed under fair use, while the extensions has been adjusted to avoid selecting images that are not under a free license . There is more future work expected in this area in order to make selections more indicative. Thanks. Melamrawy (WMF) (talk) 16:09, 3 August 2016 (UTC)Reply

Blacklist

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


How does the blacklist have to be formatted on a local page?

Like this?

File:Example_Image.jpg

Or just the title?

Example_Image.jpg

The Url Blacklist wants this format:

[[:Example_Image.jpg

I am a little bit lost here... :( Octfx (talk) 19:07, 14 September 2016 (UTC)Reply

The page at https://en.wikipedia.org/wiki/MediaWiki:Pageimages-blacklist seems to indicate that the expected format is:
* [[:File:Circle frame.svg]]
@MaxSem is that accurate?
Should we add it to the documentation as a canonical example, in Extension:PageImages#Configuration ? Quiddity (WMF) (talk) 23:19, 14 September 2016 (UTC)Reply
Thanks! That helped out a lot.
Please add it to the documentation Octfx (talk) 09:04, 15 September 2016 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Blacklist an article

[edit]

Hi, thanks a lot for this awesome extension! It really brightens up our wikis! :) And it's great to have the blacklist for images. Is it also possible to blacklist an article? We have some articles about photographers with pictures they shot and it's so weird if a picture of a model pops up in the preview (instead of the photographer). Thanks and cheers! Till Kraemer (talk) 13:22, 26 September 2016 (UTC)Reply

Hello @Till Kraemer, do you mean blacklist an article based on image content? Can you please elaborate? Thanks! Melamrawy (WMF) (talk) 10:44, 27 September 2016 (UTC)Reply
Hi @Melamrawy (WMF), thanks for your reply! Sorry, here is my situation: I'm using PageImages combined with Popups and TextExtracts. When I hover over a link to an article of a photographer without an actual image of him, a picture of one of his models shows up instead, since it is extracted from the gallery in the article. I wonder if it's possible to somehow blacklist the article of the photographer, so that no image shows up when I hover over the link to that article; kinda like an article with no image at all. I don't know if this is something which can be done with PageImages or Popups. Thanks and cheers! Till Kraemer (talk) 18:30, 27 September 2016 (UTC)Reply

Why some articles with picture do not return any

[edit]

Hi, just wondering, is there a reason why articles like [[:cs:Husův_sbor_(Olomouc-Hodolany)|this Cs:Husův sbor (Olomouc-Hodolany) one]] do not show any image? Wouldn't it be better if they showed at least the one that is there? Vojtěch Dostál (talk) 17:32, 14 November 2016 (UTC)Reply

Actually it does ..hmm why does it not work on Facebook. Vojtěch Dostál (talk) 17:36, 14 November 2016 (UTC)Reply
You can also see the image selected (if there is one) in the "action=info" (Informace o stránce) e.g. https://cs.wikipedia.org/w/index.php?title=Hus%C5%AFv_sbor_(Olomouc-Hodolany)&action=info
I don't use Facebook and am not familiar with the feature you mention. Is there an anonymously-viewable link example you could share? And perhaps a comparison with other articles, showing it working as expected? (Perhaps: one that uses the same infobox, one that uses a different infobox, and one that uses a plain image without an infobox?) Quiddity (WMF) (talk) 18:17, 14 November 2016 (UTC)Reply
Yep. This doesn't work:
https://developers.facebook.com/tools/debug/og/object/?q=https%3A%2F%2Fcs.wikipedia.org%2Fwiki%2FHus%25C5%25AFv_sbor_%28Olomouc-Hodolany%29
This (without infobox) works:
https://developers.facebook.com/tools/debug/og/object/?q=https%3A%2F%2Fcs.wikipedia.org%2Fwiki%2FHus%25C5%25AFv_sbor_%28Olomouc%29
This works (identical infobox):
https://developers.facebook.com/tools/debug/og/object/?q=https%3A%2F%2Fcs.wikipedia.org%2Fwiki%2FKostel_svat%25C3%25A9ho_Michaela_archand%25C4%259Bla_%28Kujavy%29 Vojtěch Dostál (talk) 18:23, 14 November 2016 (UTC)Reply

PHP Warning after upgrading to MediaWiki 1.28.0

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I just upgraded to MediaWiki 1.28.0 and now I'm getting the following warning:

PHP Warning:  array_flip() expects parameter 1 to be array, integer given in /path/to/wiki/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 121

Also, images of new articles don't show up in the popups anymore. Any help is more than welcome! Thanks and cheers! Till Kraemer (talk) 15:41, 30 November 2016 (UTC)Reply

I suspect that you did not upgrade PageImages to REL1_28. Apart from that I cannot tell. [[kgh]] (talk) 16:15, 30 November 2016 (UTC)Reply
@Kghbln, thanks for your reply. I did upgrade PageImages. The version file looks like this:
PageImages: REL1_28
2016-11-18T19:12:50
f3534cf
I'm running PHP 7.0.8. Thanks and cheers! Till Kraemer (talk) 20:25, 30 November 2016 (UTC)Reply
In 90 % of the cases upgrading is the issue. Now I'd recommend to report this at phabricator to make developers aware of it. [[kgh]] (talk) 20:33, 30 November 2016 (UTC)Reply
@Kghbln, thanks for your suggestion! I thought only developers have permission to post there, but it looks like I can do that too! :) Cheers! Till Kraemer (talk) 22:54, 30 November 2016 (UTC)Reply
Yeah, everybody may. :) Ah, I see you run on OpenBSD. Really liked this one though I was too inexperienced at the time to continue with it. [[kgh]] (talk) 23:22, 30 November 2016 (UTC)Reply
I am having the same problem, except that no image is shown Octfx (talk) 23:46, 30 November 2016 (UTC)Reply
Also the same error here :) NH35 (talk) 04:19, 1 December 2016 (UTC)Reply
$wgPageImagesNamespaces wasn't set here. Setting it to $wgPageImagesNamespaces = array(0); in LocalSettings.php fixed it for me. The warnings are gone and all images show up now.
@Kghbln, yeah, I love OpenBSD and Theo de Raadt's views on technology. Give it another shot sometime! :)
Thanks and cheers! Till Kraemer (talk) 14:24, 1 December 2016 (UTC)Reply

In addition to adding the <pre>$wgPageImagesNamespaces = array(0);</pre> var, try running the PageImages maintenance script. <pre>PageImages/maintenance/initImageData.php</pre>. This fixed it for me. Octfx (talk) 14:40, 1 December 2016 (UTC)Reply

Great collaboration. So the docu just needs to be updated. [[kgh]] (talk) 15:00, 1 December 2016 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Why some articles with images don't return any images?

[edit]

Why are these pictures don't work (https://goo(dot)gl/vGpTf9) but these are work (https://goo(dot)gl/2Gw9Lm) ? NH35 (talk) 14:25, 4 December 2016 (UTC)Reply

I think that is because the first article is a gallery, not regular pictures embedded in the page. Blahma (talk) 14:26, 24 May 2017 (UTC)Reply

I can't upgrade de mediawiki error extension

[edit]

Hi,

When I try to upgrade my Wiki after installing PageImages extension, It seems to be blocked, and return this error when I try to load de wiki again:


Fatal error: Uncaught exception 'Exception' with message '/home/u109381743/public_html/wiki/extensions/PageImages/extension.json: unsupported manifest_version: 2' in /home/u109381743/public_html/wiki/includes/registration/ExtensionRegistry.php:195 Stack trace: #0 /home/*****/public_html/wiki/includes/registration/ExtensionRegistry.php(137): ExtensionRegistry->readFromQueue(Array) #1 /home/*****/public_html/wiki/includes/Setup.php(39): ExtensionRegistry->loadFromQueue() #2 /home/*****/public_html/wiki/includes/WebStart.php(137): require_once('/home/*****...') #3 /home/*****/public_html/wiki/index.php(40): require('/home/*****...') #4 {main} thrown in /home/*****/public_html/wiki/includes/registration/ExtensionRegistry.php on line 195

Thanks. Guindelo (talk) 23:18, 20 December 2016 (UTC)Reply

Manually trigger LinksUpdate on all Aritcles

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


The Extension works fine and I'm very happy with it. The question now is how to trigger the Plugin on all Articles. At the moment only images are shown after I changes an Article.

Is there a way to trigger LinksUpdate on all Articles manually? Mojoaxel (talk) 09:22, 7 September 2017 (UTC)Reply

+1. It would be a basic feature... Varlin (talk) 10:35, 29 December 2017 (UTC)Reply
Hey, it is possible to do it manually. I am currently having MediaWiki 1.31.
To manually trigger this for all articles you have to start the initImageData.php in extensions/PageImages/maintenance/ folder. I do not have shell/ssh support on my provider, so I had to use MaintenanceShell extension and change the $wgMaintenanceShellPath to the mentioned path.
It looks like there is also some problem (at least on my server) with the script and I couldnt get it work properly. After some debugging I saw that I had to change LinksUpdateHookHandler.php (in PageImages/includes/) the following:
$rev = $linksUpdate->getRevision();
with:
$rev = Revision::newFromTitle($linksUpdate->getTitle());
And I managed to get all images on preview (using the Popups/PagePreviews extension)
Hope it helps someone 46.164.5.51 (talk) 22:34, 16 June 2018 (UTC)Reply
thanks Pastakhov (talk) 15:46, 20 September 2018 (UTC)Reply
Just running initImageData.php over shell did the job. THANK YOU! 80.152.229.133 (talk) 12:24, 10 April 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Installation issue

[edit]

Hi,

I have installed the extension, I can see it in Version and I can see the API property in the API sandbox. However I can't see any images preview and anything in page information too. My wiki runs also PopUps and TextExtracts (and this one works fine). Probably I am missing something very easy but I can't guess what... Loman87 (talk) 13:41, 5 December 2017 (UTC)Reply

Same problem. If I understand the problem, a page needs to be changed before the information on the image is stored and able to be used by popups. So this is linked to the other issue below : "Manually trigger LinksUpdate on all Aritcles" Varlin (talk) 10:37, 29 December 2017 (UTC)Reply

No more Image?

[edit]

Hi,

I have installed it and now I have the Problem that only one Article shows an Image if I hover over the link.

Can anybody help me?

All resolutions are nearly the same and have the same name as the Page. Theluke907 (talk) 17:50, 19 December 2017 (UTC)Reply

Image inside RandomSelection (aka <choose>) always selected over other images

[edit]

I'm writing this here in case someone has the same problem

On our main page, we had a section that varies randomly with Extension:RandomSelection, and for some unknown reason, the image chosen was always an image from the random selection instead of the logo of our wiki that was placed at the start of the page.

We had to add the logo inside another random selection (with just one option) to make it selectable by the PageImages extension. Ciencia Al Poder (talk) 20:16, 18 March 2018 (UTC)Reply

Exclude images in <ref> tags from being used.

[edit]

Annoyingly several pages use images placed inside references as the page image. I have tried to put these in blacklists or otherwise force the first image to be selected, however it would be nice to exclude images from references. 174.82.103.15 (talk) 03:03, 17 August 2018 (UTC)Reply

PHP Warning on MW 1.31

[edit]

After installing, none of my page images get added, and when I run PageImages/maintenance/initImageData.php I get the following warnings:

PHP Warning: array_flip(): Can only flip STRING and INTEGER values! in /htdocs/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 123
PHP Warning: array_flip(): Can only flip STRING and INTEGER values! in /htdocs/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 123 Bryandamon (talk) 18:25, 12 September 2018 (UTC)Reply

Tag useage of the Exstension

[edit]

I would like to use the Extension to insert in a template. So a reference-link could Show the and a Image.

Is there any tag or ability to make this happen with this Extension? 79.212.8.102 (talk) 23:13, 7 November 2018 (UTC)Reply

Loading image from sidebar

[edit]

Hello, is there any option to skip some images (e. g. from sidebar)? These aren't very representative at all... Draceane (talk) 18:02, 4 December 2018 (UTC)Reply

Updating entire wiki...

[edit]

So I've been using the OpenGraphMeta extension for ages now. As such most of my wiki has the #setmainimage tag for that extension, which seems to no longer work. I've been removing it from templates, which is most of the wiki's usage of the tag, which is fine. The problem is that if I remove it from the template, the wiki doesn't seem to load the image property unless I edit the individual page. Is it possible to force-update the entire wiki to load image properties for every single page? Titanshadow (talk) 22:30, 20 December 2018 (UTC)Reply

The #setmainimage tag still works, it's just that this extension overrides the og:image it defines with its own.
Have you tried deleting the entire wiki cache to force every page to be regenerated? Tinss (talk) 00:29, 28 February 2019 (UTC)Reply

The algorithm is configurable ...

[edit]

In Extension:PageImages#How_are_images_scored?, there are several parameters that can be set to configure the scoring. But there is no description of the valid values and the defaults. AnonymusGdpr (talk) 19:50, 25 December 2018 (UTC)Reply

images from infoboxes

[edit]

Don't displayed images from infoboxes, please hepl to fix this. 46.211.56.121 (talk) 19:14, 8 March 2019 (UTC)Reply

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
               ], 217.92.248.228 (talk) 12:49, 10 April 2019 (UTC)Reply
Its work, but I use PortableInfobox, and PageImages chose images from templates in infobox, but not the main image. How fix it? 195.138.93.32 (talk) 09:37, 6 June 2020 (UTC)Reply
Replying here as well as Extension talk:PageImages/Flow export#h-Images_included_by_transcluded_template-2021-02-08T01:02:00.000Z to report the same issue, PageImages seems to completely break when PortableInfobox is used. SlyAceZeta (talk) 00:38, 8 June 2023 (UTC)Reply
Can report the same issue. PageImages can't seem to extract images from the topmost <image> of a PortableInfobox. TaylanKammer (talk) 18:09, 30 May 2024 (UTC)Reply
Hey guys, I had the same problem. The way I fixed it by setting $wgPopupsTextExtractsIntroOnly to 'false'. I hope it will work for you too. Mayuxi (talk) 23:42, 18 February 2025 (UTC)Reply

Is there a way to transclude the image of pull it from other pages.

[edit]

I have a reused element on my website where they display "page cards" , it shows an image and the name of the page, but I need to pull this information in a lot of different locations. And the image for the page might change where other pages which were just pulling a list need the latest information.


Is there way to do something like [[File:{{Name_Of_Page/PageImage}}]] 72.28.199.40 (talk) 12:53, 1 April 2019 (UTC)Reply

Does not work

[edit]

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. 9cfilorux (talk) 09:24, 16 July 2019 (UTC)Reply

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). Ciencia Al Poder (talk) 20:26, 16 July 2019 (UTC)Reply
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 (talk) 01:11, 17 July 2019 (UTC)Reply
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. 9cfilorux (talk) 03:02, 17 July 2019 (UTC)Reply

please help

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


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 (talk) 11:36, 27 September 2019 (UTC)Reply

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; Sokote zaman (talk) 13:16, 27 September 2019 (UTC)Reply
What mediawiki version is this? Ciencia Al Poder (talk) 15:19, 27 September 2019 (UTC)Reply
tankyou
V1. 33 5.117.254.150 (talk) 16:44, 27 September 2019 (UTC)Reply
This is a problem of how you have configured the $wgPageImagesNamespaces variable in LocalSettings.php. Please review it Ciencia Al Poder (talk) 17:58, 27 September 2019 (UTC)Reply
Is this configuration correct?
$wgPageImagesNamespaces = [NS_MAIN]; Sokote zaman (talk) 18:41, 27 September 2019 (UTC)Reply
$wgPageImagesNamespaces = [NS_MAIN]; seems correct, at least that's the default value Ciencia Al Poder (talk) 13:27, 29 September 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

page_image vs. page_image_free

[edit]

What to do with pages that still have the 'page_image' property with a free (Commons) image as its value? Bdijkstra (talk) 11:59, 3 October 2019 (UTC)Reply

What problem are you trying to solve? Ciencia Al Poder (talk) 09:07, 4 October 2019 (UTC)Reply
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. Bdijkstra (talk) 09:37, 4 October 2019 (UTC)Reply

How to configure the algorithm?

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I would like to make the extension take the first image in the page by default. Vishkujo (talk) 22:45, 10 November 2019 (UTC)Reply

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. Ciencia Al Poder (talk) 10:06, 11 November 2019 (UTC)Reply
Thanks, it worked. Vishkujo (talk) 16:25, 11 November 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

No images shown in Project namespace

[edit]

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! Felix Englisch (talk) 11:49, 18 January 2021 (UTC)Reply

Extension:PageImages#Configuration says to use $wgPageImagesNamespaces. I haven't tried it. PrimeHunter (talk) 12:35, 18 January 2021 (UTC)Reply
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) Ciencia Al Poder (talk) 12:38, 18 January 2021 (UTC)Reply

Images included by transcluded template

[edit]

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. EvilPastaSalad (talk) 01:02, 8 February 2021 (UTC)Reply

Images included through transclusion of templates work fine for PageImages. Ciencia Al Poder (talk) 14:50, 8 February 2021 (UTC)Reply
I am running into the same issue. Almost every page on my wiki that uses a template powered by Extension:PortableInfobox refuses to select a page image. It doesn't even select another image from the page; it just doesn't select any at all. This is causing Popups/Page Previews to fail for almost every page with a Portable Infobox. SlyAceZeta (talk) 00:36, 8 June 2023 (UTC)Reply
Maybe Extension:PortableInfobox is the culprit here. I can assure including images from templates works fine. Example. Ciencia Al Poder (talk) 09:28, 9 June 2023 (UTC)Reply

default image for og:image

[edit]

How can I specify a default image for entire wiki when there is no image on the page? 8.41.6.110 (talk) 11:36, 28 October 2021 (UTC)Reply

You could set $wgPageImagesOpenGraphFallbackImage if the version of your MediaWiki is 1.37 or later.
$wgPageImagesOpenGraphFallbackImage = "/resources/logo.png";
Lens0021 (talk) 02:58, 29 October 2021 (UTC)Reply

class=notpageimage not working for my case

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


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! Carloposo (talk) 13:49, 6 May 2022 (UTC)Reply

This is included in REL1_38 or master branch of this extension. Ciencia Al Poder (talk) 16:34, 6 May 2022 (UTC)Reply
Thanks Carloposo (talk) 07:34, 9 May 2022 (UTC)Reply
Hello, I updated to MW1.38.1 but still not working for me.
Any idea?
Thank you in advance.
Carlo Carloposo (talk) 08:28, 1 July 2022 (UTC)Reply
My bad, it's working now. Forgot to run initImageData.php Carloposo (talk) 08:35, 1 July 2022 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

transcluding the blacklist

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


@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) Xaosflux (talk) 15:25, 9 May 2022 (UTC)Reply

No, transclusion doesn't work here. Max Semenik (talk) 10:46, 12 May 2022 (UTC)Reply
Thank you. Xaosflux (talk) 10:50, 12 May 2022 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Incompatible with Webp extension ?

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I use Extension:Webp which automatically converts all images to webp format. Huge advantage for the speed of loading the pages.

But since then, no more images recognized by Extension:PageImages... The extension does not recognize the webp format? Is there a solution? Nanash (talk) 06:43, 7 November 2022 (UTC)Reply

The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Allow external Images as PageImage

[edit]

I load in one of my wikis by some templates external images and data via automatically generated or embedded links. the pageview works flawless, but PageImages doesn't regognize them. I assume, that the listing is limited to internal files with comparision of blacklist etc.

But i have to ask for a simple solution, is there an option to allow external imagefiles to be set as PageImages, if i can set it on a "hard wire" maybe via magic word or as antonym to |class=notpageimage that would be easy to add in one of the templates. Gunnar.offel (talk) 18:50, 1 December 2022 (UTC)Reply

The images in PageImage need to be internal, because they're used in various places, like search suggestions and related articles, which need to thumbnail the image to a specific size. This of course won't work if those images are external. Ciencia Al Poder (talk) 09:50, 4 December 2022 (UTC)Reply
A deployment of all images to a wiki to get this function is not very efficent nor sensefull, it means hold the files in several places. So thanks for reply, but it means it isn't as useful in my case.
Open is the point if i can hardwire the selection by parameter or sth. Gunnar.offel (talk) 14:00, 28 March 2023 (UTC)Reply

API example needs a different page name

[edit]

The Albert Einstein example does not work because that page does not exists on mediawiki. All sandbox examples should be checked Vicarage (talk) 14:14, 22 December 2022 (UTC)Reply

I can't get this to work.

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


It shows up in Special:Version

https://mysterydungeonwiki.com/wiki/Special:Version


I've added "$wgPageImagesNamespaces" along with a list of all of my wiki's custom namespaces and it's not working.

https://mysterydungeonwiki.com/wiki/Shiren:Blacksmith?action=info


I've ran "cd w/maintenance /php update.php". and refreshLinks.php and that didn't seem to do anything. I'm out of ideas SungHerSong (talk) 09:24, 14 February 2023 (UTC)Reply

https://mysterydungeonwiki.com/wiki/Special:AllPages shows mainspace pages. It works there, e.g. https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Wiki/Latest_Game?action=info
It's only enabled in mainspace by default. What is your code for $wgPageImagesNamespaces? Do you have evidence that other code in the file is used? PrimeHunter (talk) 11:54, 14 February 2023 (UTC)Reply
> wfLoadExtension( 'PageImages' );
> $wgPageImagesExpandOpenSearchXml = true;
> $wgPageImagesLeadSectionOnly = true;
$wgPageImagesNamespaces = array( -1 => 0, 0 => 1, 1 => 0,
  2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 3000 => 0, 3002 => 0, 3004 => 0, 3006 => 1, 3008 => 1,
  3018 => 1, 3020 => 1, 3022 => 1, 3024 => 1, 3026 => 1, 3028 => 1, 3030  => 1, 3030  => 1, 3032  => 1, 3034  => 1, 3036  => 1, 3038  => 1,
  3040  => 1, 3042  => 1, 3044  => 1, 3046  => 1, 3048  => 1, 3050  => 1, 3052  => 1, 3054  => 1, 3056  => 1, 3058  => 1, 3060  => 1,
  3062  => 1, 3064  => 1, 3066  => 1, 3068  => 1, 3070  => 1, 3072  => 1, 3074  => 1, 3076  => 1, 3078  => 1, 3080  => 1, 3082  => 1,
  3084  => 1, 3086  => 1, 3088  => 1, 3090  => 1, 3094  => 1, 3096  => 1, 3098  => 1, 3100  => 1, 3102  => 1, 3104  => 1, 3106  => 1,
  3108  => 1, 3110  => 1, 3112  => 1, 3114  => 1, 3116  => 1, 3118  => 1, 3120  => 1, 3122  => 1, 3124  => 1, 3126  => 1, 3128  => 1,
  3130  => 1, 3132  => 1, 3134  => 1, 3136  => 1, 3138  => 1, 3140  => 1, 3142  => 1, 3144  => 1, 3146  => 1, 3148  => 1, 3150  => 1,
  3152  => 1, 3154  => 1, 3156  => 1, 3158  => 1, 3160  => 1, 3162  => 1, 3164  => 1, 3166  => 1, 3168  => 1, 3170  => 1, 3172  => 1,
  3174  => 1 );
I also tried the following, which didn't work.
$wgPageImagesNamespaces[] = 3036; SungHerSong (talk) 05:02, 15 February 2023 (UTC)Reply
Try to merely list the wanted namespaces: array(0, 3006, 3008, ..., 3036, ...) PrimeHunter (talk) 05:30, 15 February 2023 (UTC)Reply
Alright, I figured it out. The array didn't work, possibly for the reason you mentioned.
However, the second formatting did work. I just forgot I needed to edit the page before it would work. It's working now. [3] SungHerSong (talk) 05:57, 15 February 2023 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

How do I add my logo to the banlist?

[edit]

The code on the extension page doesn't help at all. It shows links, but doesn't tell me WHERE to put them. On top of that, my logo is in the assets folder, so how do I remove it when it's not a file I can link to? Everything I try, breaks the wiki until I remove the code. SungHerSong (talk) 15:45, 18 February 2023 (UTC)Reply

If your post is about an unwanted page image seen with action=info then please link an example page with the problem. PrimeHunter (talk) 21:11, 18 February 2023 (UTC)Reply
https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Franchise_Wiki
My co-admin made a widget, which I believe currently overrides it. SungHerSong (talk) 11:54, 19 February 2023 (UTC)Reply
https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Franchise_Wiki?action=info currently shows https://mysterydungeonwiki.com/wiki/File:Shiren_the_Wanderer_-_The_Tower_of_Fortune_and_the_Dice_of_Fate_iPad_banner.png, I don't know whether this is unwanted. PrimeHunter (talk) 15:42, 19 February 2023 (UTC)Reply

Page Previews rejects small page images

[edit]

Page Previews rejects some small images which have been selected as page image: Extension:Popups#Known problems. Extension talk:Popups/2022#h-Image_size_requirement-20220829122400 tries to state the requirement more clearly. There is an example here: How come some images show up while hovering on some articles and on others they do not? Popups is a different extension but it's a prominent use of PageImages and can confuse users so I suggest a brief mention here, maybe my opening sentence. PrimeHunter (talk) 20:42, 31 March 2023 (UTC)Reply

Looking for a solution with smaller-ish images

[edit]

Hi, On our wiki, a lot of our images are 150 x 150 images, and we'd like to get these considered to be page images for articles.

I've looked at the setting for width, but I'm not sure exactly what kind of scoring I should set for that. Would something like this work?

$wgPageImagesScores['width']= {

"119": -100,

"150": 11,

"400": 10,

"600": 5,

"601": 0

}; Blinkingline (talk) 14:07, 3 April 2023 (UTC)Reply

Images down to 120px are allowed by default. Your code only makes a difference if you prefer 120-150px against more than 150px on pages with multiple images. I didn't find any page with a page image in your wiki, and https://buttonmen.miraheze.org/wiki/Main_Page has a 300px image. https://buttonmen.miraheze.org/wiki/Special:Version says PageImages is installed. Have you run "initImageData.php" per Extension:PageImages#Installation? PrimeHunter (talk) 14:49, 3 April 2023 (UTC)Reply

List of pages without pageimage

[edit]

Hello! How to get the list of all pages on wiki that don't have pageimage? 5.53.113.93 (talk) 14:55, 19 April 2023 (UTC)Reply

One way is via a Quarry query such as this one. Registered users can fork the query and adjust it to their wishes. Bdijkstra (talk) 17:54, 19 April 2023 (UTC)Reply

Return pageimages in API

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I'm running the following API call: /w/api.php?action=query&list=categorymembers&cmprop=title|sortkeyprefix&cmnamespace=0&cmtitle=Category:Flower to return a list of articles in the "Flower" category.

With the information in Extension:PageImages#API, since this is using the query action, I can get a list of pageimage information by adding "prop=pageimages" to the url to make /w/api.php?action=query&list=categorymembers&cmprop=title|sortkeyprefix&cmnamespace=0&cmtitle=Category:Flower&prop=pageimages

I was expecting the pageimages for each of the pages but the results didn't change.

Since I had an existing "cmprop" parameter, I also tried adding it there to make /w/api.php?action=query&list=categorymembers&cmprop=title|sortkeyprefix|pageimages&cmnamespace=0&cmtitle=Category:Flower but that didn't change anything either.

Am I able to change the url to get the pageimage information for all the pages in the category? 70.160.223.43 (talk) 00:18, 27 June 2023 (UTC)Reply

You need to use categorymembers as a generator, instead of list, because otherwise you are be requesting the pageimage information from the category instead of the members Ciencia Al Poder (talk) 08:57, 27 June 2023 (UTC)Reply
Thanks, that worked perfectly! 70.160.223.43 (talk) 23:16, 27 June 2023 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Any way to make the extension consider just a single image?

[edit]

In the MediaWiki instance I manage, PageImages produces multiple og:image tags, and in some websites, they all get picked up. Is there any way to make the extension consider only the first image and produce a single og:image tag? Marx.FelipeForte (talk) 17:41, 17 January 2024 (UTC)Reply

Looks like it's currently not possible Ciencia Al Poder (talk) 22:19, 25 January 2024 (UTC)Reply

How do I exclude a page from having a page image?

[edit]

How do I exclude a page from having a page image? V G5001 (talk) 22:20, 29 January 2024 (UTC)Reply

You can mark all potential page images on the page with |class=notpageimage per Extension:PageImages#Can I exclude certain page images? PrimeHunter (talk) 22:33, 29 January 2024 (UTC)Reply
Is there really no other way? Since I would want to do that for the main page of a wiki, which is wholly comprised of templates, and the images in it may change from time to time. V G5001 (talk) 23:07, 29 January 2024 (UTC)Reply

Exclude infobox image from page images

[edit]

I`ve got two questions related to the algorithm work for infoboxes:

1. How do I exclude specific infobox image with class=notpageimage if it comes from wikidata (it is used in other languages wikis' infoboxes)? The only way is to delete the image on wikidata page (from the "Image" section). But what if I want to leave it on wikidata and just apply class=notpageimage to let the algorithm choose another picture as page image.

2. How do I exclude specific infobox image with class=notpageimage if the image file name is not in square brackets [[]] but the part of infobox template {{}}? Borisenko-ru (talk) 16:06, 12 March 2024 (UTC)Reply

  1. You could add a parameter to the infobox template that does that.
  2. Same. Bdijkstra (talk) 17:22, 12 March 2024 (UTC)Reply
An image is still displayed with image code like [[File:Example.png]] if the image is taken from wikidata and added by an infobox. The infobox generates the image code and could add an optional parameter to instead say [[File:Example.png|class=notpageimage]]. A more hacky solution is to use the local Special:ExpandTemplates to see the precise code generated by the infobox and then wrap the whole infobox call in a string function which changes the image code to add |class=notpageimage. If the wiki has Module:String then Module:String#replace can be used. It's not pretty and may be unstable if changes are later made to the infobox. PrimeHunter (talk) 18:50, 12 March 2024 (UTC)Reply

Warning when running initImageData.php on MediaWiki 1.40

[edit]

I received the below warning when running initImageData.php. It seems to have worked fine, but a note should be added on the Configuration section explaining how to use maintenance/run.php (or if it's safe to simply ignore this warning).

C:\inetpub\wwwroot\mediawiki\extensions\PageImages\maintenance>php initImageData.php

*******************************************************************************

NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!

      Running scripts directly has been deprecated in MediaWiki 1.40.

      It may not work for some (or any) scripts in the future.

*******************************************************************************

35

done

I'm not sure if this needs to be updated in the extension code itself. MikeDarling (talk) 16:27, 15 August 2024 (UTC)Reply

We should probably just hook the maintenance script up to update.php like most extensions do? Jdforrester (WMF) (talk) 22:57, 20 August 2024 (UTC)Reply
Have quickly written https://gerrit.wikimedia.org/r/c/mediawiki/extensions/PageImages/+/1064129 but not tested it yet. Jdforrester (WMF) (talk) 23:09, 20 August 2024 (UTC)Reply