Jump to content

Module talk:InfoboxImage: Difference between revisions

From Fifth Empire Wiki
m 372 revisions imported from wikipedia:Module_talk:InfoboxImage
 
(80 intermediate revisions by 15 users not shown)
Line 4: Line 4:
|archiveheader      = {{talkarchivenav}}
|archiveheader      = {{talkarchivenav}}
|maxarchivesize      = 75K
|maxarchivesize      = 75K
|counter            = 1
|counter            = 4
|minthreadsleft      = 10
|minthreadsleft      = 4
|minthreadstoarchive = 2
|minthreadstoarchive = 1
|algo                = old(365d)
|algo                = old(365d)
|archive            = Module talk:InfoboxImage/Archive %(counter)d
|archive            = Module talk:InfoboxImage/Archive %(counter)d
Line 12: Line 12:
{{archives|search=yes}}
{{archives|search=yes}}


== Template-protected edit request on 8 June 2021 ==
== Other size parameters cause upright to be ignored ==


{{edit template-protected|Module:InfoboxImage|answered=yes}}
With the current implementation of this module, the upright parameter is ignored if the maxsize or sizedefault parameters are defined. This appears to be because image syntax ignores upright if a size in pixels is defined. It means that if either of those parameters are used in an infobox template (see {{tl|Infobox bridge}} for example), then it's not possible to use the upright parameter at all in articles, which is not the intended behavior.
I would like to have Judge Rose's photo on her Wikipedia profile page updated. I'm passing this request along from Judge Rose herself. I have an updated photo from her that I can send to you but wanted to confirm that I'm in the right place to request this change. [[User:8thcirc|8thcirc]] ([[User talk:8thcirc|talk]]) 19:04, 8 June 2021 (UTC)
:{{to|8thcirc}} [[File:Red information icon with gradient background.svg|20px|link=|alt=]] '''Not done:''' this is the [[Help:Talk pages|talk page]] for discussing improvements to the page [[:Module:InfoboxImage]]. If possible, please make your request at the talk page for the article concerned. If you cannot edit the article's talk page, you can instead make your request at [[Wikipedia:Requests for page protection#Current requests for edits to a protected page]].<!-- Template:ETp --> '''''[[User:Paine Ellsworth|<span style="font-size:92%;color:darkblue;font-family:Segoe Script">P.I.&nbsp;Ellsworth</span>]]'''''&nbsp;&nbsp;[[Editor|<span style="color:black">ed.</span>]]&nbsp;[[User talk:Paine Ellsworth|<sup>put'r&nbsp;there</sup>]]&nbsp;<small>22:55, 8 June 2021 (UTC)</small>


== none options for link and alt ==
I don't have the Lua skills to do so, but I think the module should be rewritten so that a pixel size is not passed if the upright parameter is used and the size parameter is not. [[User:Pi.1415926535|Pi.1415926535]] ([[User talk:Pi.1415926535|talk]]) 03:27, 30 May 2025 (UTC)


We should probably add none options for link and alt. It would be useful in places such as {{tl|archives}} but likely other non-infobox templates using this as well since this is the most versetile image handling template. --[[User:Trialpears|Trialpears]] ([[User talk:Trialpears|talk]]) 15:14, 11 August 2021 (UTC)
:I think there are two separate cases to consider:
:Seems like a good idea. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 21:10, 11 August 2021 (UTC)
:# Both {{para|upright}} and either {{para|maxsize}} or {{para|sizedefault}} are specified
:# Both {{para|upright}} and {{para|size}} are specified
:In the first case, I think the current module behavior is likely incorrect -- the caller specified a size via {{para|upright}} and it's being handled as if no size was specified. The second case is less clear, because conflicting sizes are being provided. I'm reluctant to change the current behavior for the second case, because there may be unintended consequences to the 5M articles that use this module.
:Of course, fixing the incorrect behavior also may have unintended consequences, also, so we should be careful. For example, the proposed behavior now allows people to set absurd values to {{para|upright}} and there is no check or limit.
:I've modified [[Module:InfoboxImage/sandbox|the sandbox]] to fix the first issue, and updated [[Module:InfoboxImage/testcases|the tests]] to exercise the new code. {{Pinging|WOSlinker}} to see if they have any comments on the change: other editors are also welcome to comment. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 09:17, 30 May 2025 (UTC)
::Later: I added some logic to ensure that {{para|upright}} doesn't produce an image larger than {{para|maxsize}}, assuming the default user preference. This fixes one potential issue. Updated sandbox and testcases. I'm hoping some other templateeditor or admin takes a look at the [https://en.wikipedia.org/w/index.php?title=Special%3AComparePages&page1=Module%3AInfoboxImage&page2=Module%3AInfoboxImage%2Fsandbox diff]. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 10:01, 30 May 2025 (UTC)
:::@[[User:Hike395|Hike395]]: Thanks for looking into this! Just to clarify - will this still allow an image scaled with upright to be larger than maxsize if the user preference is set to a larger-than-default value? That seems important for accessibility reasons. [[User:Pi.1415926535|Pi.1415926535]] ([[User talk:Pi.1415926535|talk]]) 16:09, 30 May 2025 (UTC)
::::Yes: if upright is specified, then maxsize will scale with the user's default image size. So if maxsize=300, and the user's preferred thumbnail size is set to 300px, then the output image will be limited to be less than 300*300/220 = 409px for that user. There's no way to avoid this. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 00:39, 31 May 2025 (UTC)
:::::Great, that is the behavior I believe it should have. [[User:Pi.1415926535|Pi.1415926535]] ([[User talk:Pi.1415926535|talk]]) 00:45, 31 May 2025 (UTC)
:To the original observation {{tq|the upright parameter is ignored if the maxsize or sizedefault parameters are defined. This appears to be because image syntax ignores upright if a size in pixels is defined}}: this is expected behaviour, and is documented at [[WP:PICSIZE]], inside the "Implementation details" box ([[WP:EIS#Implementation details|direct link]]), last paragraph. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] &#x1f339; ([[User talk:Redrose64|talk]]) 13:39, 31 May 2025 (UTC)
::{{ping|Pi.1415926535|Redrose64}} Picking this back up. My sandbox edits do not contradict [[WP:PICSIZE]]. If a absolute size and an upright are both specified, then the absolute size is used. What I did was scale maxsize and sizedefault relative to the user preferred image size. Those two parameters are only defined in this module: [[WP:PICSIZE]] does not discuss them.
::Is it ok to promote the sandbox to main? I see that since this edit, Pi.14 has removed maxsize and sizedefault from a number of infoboxes. It would be good to restore those, if I can promote sandbox to main. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 08:48, 5 August 2025 (UTC)
:::{{ping|Pi.1415926535|Redrose64}} Any comments or thoughts before I propose this as an edit? {{U|Pppery}} just [[WP:FULL|fully protected]] this Module, so I can no longer edit it, so even a simple support/agree would be helpful. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 14:46, 12 August 2025 (UTC)
:::: To be clear, my full protection was completely unrelated to this dispute, which I didn't even know existed; if you look at my edits at the time I adjusted the protection level of hundreds of templates. [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 17:35, 12 August 2025 (UTC)
:::::If I'm understanding correctly what your edit does, I support it. I'm confused about your statement {{tq|Pi.14 has removed maxsize and sizedefault from a number of infoboxes}} - to my knowledge, I haven't edited any infobox templates to remove these. [[User:Pi.1415926535|Pi.1415926535]] ([[User talk:Pi.1415926535|talk]]) 05:12, 13 August 2025 (UTC)
::::::{{ping|Pppery}} apologies. I didn't mean to imply causation here -- I just wanted to point out that I can no longer edit the template directly.
::::::{{ping|Pi.1415926535}} more apologies. I recall seeing edits to infoboxes which removed maxsize and sizedefault, but now I cannot find them to check who did them. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 12:33, 13 August 2025 (UTC)
===Edit request===
{{FPER|answered=yes}}
Please copy [[Module:InfoboxImage/sandbox]] to [[Module:InfoboxImage]]


== Module breaks when there are multiple images on Wikidata ==
This is a change in handling the case where {{para|upright}} and either {{para|maxsize}} or {{para|sizedefault}} is specified. In this case, the sandbox version obeys {{para|upright}}, but if it exceeds <code>maxsize/220</code>, then it is set to <code>maxsize/220</code>. The current behavior is to ignore {{para|upright}} when either {{para|maxsize}} or {{para|sizedefault}} is specified, which is incorrect.


In a [https://en.wikipedia.org/w/index.php?title=ARIA_Music_Awards_of_2014&oldid=1029676267 recent edit] the Module broke because there were three different images set on Wikidata, and the Module tried interpreting them as one, which doesn't work. Is there a way to recognize this and use them all separately? ''-- [[User:Asartea|<span style="color:#ad0000;">Asartea</span>]] [[User Talk:Asartea|<span style="color:#ad0000;"><sup>Talk</sup></span>]] <sup>&#124;</sup> [[Special:Contributions/Asartea|<span style="color:#ad0000;"><sup>Contribs</sup></span>]]'' 15:49, 29 August 2021 (UTC)
This edit does not change any behavior if {{para|upright}} is not specified. Also, if {{para|size}} and {{para|upright}} are both specified, the behavior remains unchanged: {{para|size}} is obeyed in that case.
:Are you sure that this description is correct? On the testcases page, I am seeing the Mustela image with <syntaxhighlight>upright=1.5|sizedefault=272|maxsize=300</syntaxhighlight>. The live module renders the image at 1.5x my thumbnail size. The sandbox image is rendered at 272px. This seems to be the opposite of the description above, if I am reading it correctly. It also seems to be a fix that helps the module to match normal image rendering (px is preferred over upright). Is this what you want? – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 17:01, 15 August 2025 (UTC)
::You may be interpreting the unit tests backward? Here are the results when main and sandbox are called with the case that you are highlighting:
:::<code><nowiki>{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|sizedefault=272|maxsize=300}}</nowiki></code> →
[[File:Mustela erminea upright.jpg|272px|upright=1]]
:::<code><nowiki>{{subst:#invoke:InfoboxImage/sandbox|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|sizedefault=272|maxsize=300}}</nowiki></code> →
[[File:Mustela erminea upright.jpg|frameless|upright=1]]
:::Here, the main module is generating a pic with size=272px, while the sandbox module is generating a pic with upright=1 (rendered at your preferred size). So the logic is correct.
:::The logic has not changed when both size and upright are specified. They are both emitted and MediaWiki prefers size over upright:
:::<code><nowiki>{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|size=200}}</nowiki></code> →
[[File:Mustela erminea upright.jpg|200px|upright=1]]
:::<code><nowiki>{{subst:#invoke:InfoboxImage/sandbox|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|size=200}}</nowiki></code> →
[[File:Mustela erminea upright.jpg|200px|upright=1]]
:::— [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 17:18, 15 August 2025 (UTC)
::::Indeed, I do not understand what "Expected" and "Actual" refer to on that page. I'm used to seeing the live template followed by the sandbox, with appropriate headers to match. In that case, and based on the apparent consensus above, I have no objections. It looks like this change will require an administrator, which I am not. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 17:25, 15 August 2025 (UTC)
::::: {{ping|Redrose64}} Do you object to this request? [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 19:48, 15 August 2025 (UTC)
::::::I'm not a Lua expert, and have never claimed to be. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] &#x1f339; ([[User talk:Redrose64|talk]]) 22:18, 16 August 2025 (UTC)


== Module update ==
{{Done}} [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 04:35, 17 August 2025 (UTC)


I've done some work in the sandbox. The original intent was to add an error category for when URL links are used for images, as currently it just returns an empty string. While working on the code I've also cleaned up the code, including:
== Default maxsize to 250px ==
* Consistent spaces
* Consistent usage of quotation marks
* Using table.param instead of table["param"]
* Reordering the placeholder_image table alphabatically
* Removing ";" from the end of lines as Lua does not use that.


I've replaced the following block of code at [[Module:InfoboxImage#L-144]]:
I’ve recently been coming across a lot of Infoboxes with substatially large images in their infoboxes. 300-400px in size. Can we modify this module to default to a {{code|maxsize}} of 250px? If for some reason a particular infobox wants to override that, that’s another matter, but that way we can at least cut down on the number of large images? If there is no objection to this change, I’m happy to write the code in the sandbox and do a formal edit request. '''[[User:Zackmann08|<span style="color:#00ced1">Zack</span><span style="color:#007F94">mann</span>]]''' (<sup>[[User_talk:Zackmann08|Talk to me]]</sup>/<sub>[[Special:Contributions/Zackmann08|<span style="color:orange;">What I been doing</span>]]</sub>) 07:37, 30 September 2025 (UTC)
<syntaxhighlight lang="lua">
:A few comments:
    if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then
:#I would be extremely cautious about setting defaults in this template. It's used on 5M pages and in system messages. The probability of unintended consequences is high.
        return "";
:#Looking at [https://en.wikipedia.org/w/index.php?title=Special:Search&limit=500&offset=0&ns10=1&search=insource%3AInfoboxImage+insource%3Asizedefault the usage of {{para|sizedefault}}], I see many templates use {{para|sizedefault|frameless}}. With the current code, such a default will ignore maxsize.
    end
:#Looking at [https://en.wikipedia.org/w/index.php?title=Special:Search&limit=500&offset=0&ns10=1&search=insource%3AInfoboxImage+insource%3Amaxsize the usage of {{para|maxsize}}], many templates set maxsize larger than 250px. The largest ones appear to be 325px. To be conservative, the default maxsize should set to a high value (e.g., 325px). I think, however, it would be safer not to have a default maxsize.
    if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then
:— [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 10:11, 30 September 2025 (UTC)
        return "";
::We should not standardize on a pixel size, per [[MOS:IMGSIZE]] ({{tq|Except with very good reason, a fixed width in pixels (e.g. 17px) should not be specified, because it ignores the user's base width setting.}}). See [[Module_talk:InfoboxImage#Help_with_improving_default_image_sizes|the discussion above]], which proposes to somehow default to the viewer's preferred thumbnail size, and [[Template_talk:Infobox_bridge/Archive_2#Image_and_map_widths|the 2022 discussion that led to the one above]]. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 10:44, 30 September 2025 (UTC)
    end
:::Per {{diff|title=Module:InfoboxImage|diff=prev|oldid=1306324007|label=this recent edit}}, setting {{para|maxsize}} does not standardize on a pixel size. If we do set {{para|maxsize|250}}, then it limits {{para|size}} to 250 and limits {{para|upright}} to 1.136. px is not forced or favored in any way.
    if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then
:::Also -- I just cleaned up <s>all</s> uses of {{para|sizedefault|frameless}}, so that is no longer a factor in any decision. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 13:52, 30 September 2025 (UTC)
        return "";
::::Thanks for both of those. Based on the above discussion, which I had forgotten about because I got so mixed up, it looks like the sizedefault of frameless will override the maxsize as long as size= is not specified. I tested <code>sizedefault=frameless|maxsize=250</code> in my sandbox and got a 300px image, which is the same as my thumbnail preference. If I set <code>sizedefault=frameless|maxsize=250|size=100</code>, I get a 100px image. Based on that, it looks like a <s>sizedefault</s> <ins>maxsize</ins> of 250px would prevent images from getting larger than the editor's preferred thumb size unless size= is specifically set. Caveat: I might not be testing all possible cases. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 14:12, 30 September 2025 (UTC)
    end
:::::To clarify: the behavior with {{para|sizedefault|frameless}} is a bug. Maybe I should fix the bug rather than cleaning up occurrences of {{para|sizedefault|frameless}}, although fixing the bug would add 3 lines of special-purpose code for that case.
    if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then
:::::To see the correct behavior, if you try <code>maxsize=250</code> you should get 250px, if you try <code>upright=1|maxsize=250</code> you should get 300px, while if you try <code>upright=1.5|maxsize=250</code> you should get 340px (limited by maxsize). — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 14:44, 30 September 2025 (UTC)
        return "";
::::::Yeah, now I'm confused again.
    end
::::::*When I set <code>maxsize=250</code>, I get 250px (my thumb size is 300px, and I thought sizedefault=frameless was being set by default, so I was expecting 300px).
    if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then
::::::*When I set <code>|upright=1|maxsize=200</code>, I get 270px (about 137% of maxsize, so it doesn't match maxsize or the upright setting).  
        return "";
::::::*When I set <code>|upright=1|maxsize=250</code>, I get 300px (my thumb size preference; this seems correct).  
    end
::::::*When I set <code>|upright=1|maxsize=300</code>, I get 300px (my thumb size preference; this seems correct).  
    if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then
::::::*When I set <code>|upright=1.5|maxsize=300</code>, I get 412px (about 137% of maxsize and my thumb size, so it doesn't match maxsize or the upright setting).
        return "";
::::::The code I am using in a Preview window in my sandbox looks like <syntaxhighlight inline lang=wikitext>{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|maxsize=300}}</syntaxhighlight>. Somebody please explain it to me like I'm not very smart. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 16:22, 30 September 2025 (UTC)
    end
:::::::The maxsize parameter is to limit the value of the size parameter. Normally in an infobox template you would have <syntaxhighlight inline lang=wikitext>image = {{subst:#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size}}}|maxsize=300}}</syntaxhighlight> and then when used on an article with <syntaxhighlight inline lang=wikitext>{{Infobox something|image=abc.jpg|image_size=500}}</syntaxhighlight>, the image size would be limited to 300. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 18:26, 30 September 2025 (UTC)
</syntaxhighlight>
{{od|7}} To understand the behavior, see [[#Other size parameters cause upright to be ignored|the discussion above]]. The maximum size (in px) for InfoboxImage when upright is specified is (maxsize/220)*(your thumbnail preference).
:When you set maxsize=200, you are saying that the max upright is 200/220 = 0.909, which is 272px.
:When you set maxsize=250, you are saying that the max upright is 250/220 = 1.136, which is 341px. Upright=1 thus gives 300px for you.
:When you set maxsize=300, you are saying that the max upright is 300/220 = 1.364, which is 409px for you. Upright=1 thus gives 300px, but upright=1.5 gets limited to 1.364 which is 409px.
The 220 comes from the default user thumbnail size. Hope this helps. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 22:37, 30 September 2025 (UTC)
 
:[https://en.wikipedia.org/w/index.php?title=Atuwatse_I&oldid=1305079334 Here] is an example of what a default {{code|maxsize}} would help prevent… - '''[[User:Zackmann08|<span style="color:#00ced1">Zack</span><span style="color:#007F94">mann</span>]]''' (<sup>[[User_talk:Zackmann08|Talk to me]]</sup>/<sub>[[Special:Contributions/Zackmann08|<span style="color:orange;">What I been doing</span>]]</sub>) 01:06, 1 October 2025 (UTC)
::{{ping|Zackmann08}} sorry for the bad news, but that article uses {{tl|Infobox royalty}} that already has {{para|maxsize|300}}. Adding a default maxsize would do anything in this case. What this module produces with that input is <nowiki>[[File:Olu Atuwatse I Dom Domingos.jpg|300x|upright=1]]</nowiki>. The "300x" is a syntax error, so the Wiki image markup just displays the image at full resolution (which is 5286x4119px).
::We could attempt to harden the output of the module so that junk doesn't "leak through". This is separate from maxsize. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 02:46, 1 October 2025 (UTC)
:::{{ping|Hike395}} I added the {{para|maxsize|300}} {{Diff|Template:Infobox royalty|1314363626|1313895985|here}} as a result of finding that page. But good to know that maxsize wouldn’t have prevented it. {{smiley|sad}} — '''[[User:Zackmann08|<span style="color:#00ced1">Zack</span><span style="color:#007F94">mann</span>]]''' (<sup>[[User_talk:Zackmann08|Talk to me]]</sup>/<sub>[[Special:Contributions/Zackmann08|<span style="color:orange;">What I been doing</span>]]</sub>) 02:49, 1 October 2025 (UTC)
:Continuing from [[Template talk:Infobox settlement#Max size]] :) My [[Special:Preferences#mw-prefsection-rendering-files]] says 250px, and I don't remember having changed this myself.
:So the use of 220 in this module needs to be abstracted away into some sort of a variable, because it looks like this isn't making a lot of sense otherwise. --[[User:Joy|Joy]] ([[User talk:Joy|talk]]) 10:18, 17 October 2025 (UTC)
::And if [[Wikipedia:Image use policy#Displayed image size]] tells editors {{tq|Except with very good reason, do not use px [...], which forces a fixed image width measured in pixels, disregarding the user's image size preference setting.}}, then this module should also support relative sizes as well, instead of forcing this sort of pixel-based thinking from editors. --[[User:Joy|Joy]] ([[User talk:Joy|talk]]) 10:20, 17 October 2025 (UTC)
:The default thumbnail size used to be 220px but changed to 250px in April 2025. See [[Wikipedia:Tech_news/Archive_13#Tech_News:_2025-16]]. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 17:59, 17 October 2025 (UTC)
===Edit request 17 October 2025===
{{FPER|answered=yes}}
Please copy the [[Module:InfoboxImage/sandbox|sandbox]] to [[Module:InfoboxImage|main]].


with [[Module:InfoboxImage/sandbox#L-137]]:
Two changes:
# (technical) --- factored out list of placeholder images and tracking categories into [[Module:InfoboxImage/data]] to neaten beginning of module
# (substantive) --- per discussion above, the systemwide default thumbnail size is now 250px. Factored this value out of existing code and turned it into constant at beginning of module. This introduces two expected "errors" into the [[Module talk:InfoboxImage/testcases|test cases]].
{{pinging|WOSlinker}} who brought this up. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 02:28, 18 October 2025 (UTC)
:{{done}} -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 09:46, 18 October 2025 (UTC)


<syntaxhighlight lang="lua">
== UPDATE PROFILE IMAGE ==
if string.find(image, "^%[*http") then
-- Error category.
return "[[Category:Pages using infoboxes with url links]]"
end
</syntaxhighlight>


I've added URL testcases to [[Module:InfoboxImage/testcases]]. The new tests and all previous tests pass [[Module talk:InfoboxImage/testcases]].
{{edit fully-protected|Module:InfoboxImage|answered=yes}}
Please change the profile photo to the following image https://commons.wikimedia.org/wiki/File:Walter_Masterson.jpg [[User:Wikispiraling|Wikispiraling]] ([[User talk:Wikispiraling|talk]]) 23:54, 24 November 2025 (UTC)
: {{ping|Wikispiraling}} This page is for discussions concerning use and development of the module [[Module:InfoboxImage]]. I can only assume that you are intending to ask for the image you have mentioned to be put in the article [[Walter Masterson]]; if so the request belongs in the talk page of whatever article that is, not here. [[User:JBW|JBW]] ([[User talk:JBW|talk]]) 00:04, 25 November 2025 (UTC)


Please let me know if you have comments or questions. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 09:04, 2 October 2021 (UTC)
==Discussion at [[:Template talk:MergedMap]]==
:There are [//commons.wikimedia.org/wiki/Special:AllPages?from=http&to=&namespace=6  quite a few] images at commons whose names begin with the letters "http". Will this code drop them into the error category? Perhaps "^%[*https?:" would be safer, if that's the correct regex syntax for string.find -- [[User:John of Reading|John of Reading]] ([[User talk:John of Reading|talk]]) 09:21, 2 October 2021 (UTC)
[[File:Symbol watching blue lashes high contrast.svg|25px|link=|alt=]]&nbsp;You are invited to join the discussion at [[:Template talk:MergedMap]]. &#x0020;--<!-- Template:Please see --> [[User:Joy|Joy]] ([[User talk:Joy|talk]]) 12:48, 27 November 2025 (UTC)
::I've added a test for an image from commons that starts with HTTP and it worked. That said I've also now updated the sandbox with your suggested code to make it more correct. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 09:35, 2 October 2021 (UTC)


== Why is "alt" the fallback for "title"? ==
== Captions ==


In this condition
Is there a reliable way to get captions from wikidata? I don't think this module deals with captions at all, which is surprising. We have an issue on [[Template:Infobox martial artist]] where the caption is not always matching the image. This module was using the preferred image but [[Module:Wikidata]] was taking the caption from a different image &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 09:23, 6 January 2026 (UTC)
<syntaxhighlight lang="lua" line start="269">
:That infobox is checking the image and caption params independently.
if title ~= "" and title ~= nil then
:<syntaxhighlight lang="wikitext">
    result = result .. "|" .. title;
{{if empty|{{{image|}}}|{{#invoke:Wikidata|claim|P18}}}}
elseif alt ~= "" and alt ~= nil then
{{if empty|{{{caption|}}}|{{#invoke:Wikidata|getImageLegend|FETCH_WIKIDATA}}}}
    result = result .. "|" .. alt;
</syntaxhighlight>
end
:Maybe needs to check both params are empty before using any wikidata values?
:<syntaxhighlight lang="wikitext">
{{#ifeq:{{{image|}}}{{{caption|}}}||{{#invoke:Wikidata|claim|P18}}|{{{image|}}}}}
{{#ifeq:{{{image|}}}{{{caption|}}}||{{#invoke:Wikidata|getImageLegend|FETCH_WIKIDATA}}|{{{caption|}}}}}
</syntaxhighlight>
</syntaxhighlight>
{{para|alt}} is used as the fallback for an image title when {{para|title}} is not present. This appears arbitrary to me and it diverges from the usual behavior of {{para|alt}} in [[File:]] constructs. As a result, articles that use InfoboxImage and alt (but not title) for each image suddenly have a title on the infobox image, but none on all others. Is there a reason that this is the case? Can this behavior be corrected (by removing lines 271 and 272)? [[User:IceWelder|<span style="font-variant: small-caps;">IceWelder</span>]] &#91;[[User talk:IceWelder|<span style="color: #424242;">&#9993;</span>]]&#93; 07:38, 26 October 2021 (UTC)
:[[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 10:04, 6 January 2026 (UTC)
: Not sure whether anyone is even watching this talk page. {{Ping|WOSlinker}} You're the most active editor on the module. Would you mind sharing your insight? [[User:IceWelder|<span style="font-variant: small-caps;">IceWelder</span>]] &#91;[[User talk:IceWelder|<span style="color: #424242;">&#9993;</span>]]&#93; 17:22, 27 October 2021 (UTC)
:: It was just done that way so that the hover over tooltip showed some information. If there are no objections in the next week then I'll remove it. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 18:29, 27 October 2021 (UTC)
::: I've updated it. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 18:26, 5 November 2021 (UTC)
:::: I made this corresponding doc update https://en.wikipedia.org/w/index.php?title=Module:InfoboxImage/doc&type=revision&diff=1065533441&oldid=1048551125&diffmode=source Note that lines 259-262 now seem redundant <syntaxhighlight lang="lua">
        -- if alt value is a keyword then do not use as a description
        if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then
            alt = nil;
        end
</syntaxhighlight> [[User:Arlolra|Arlolra]] ([[User talk:Arlolra|talk]]) 01:58, 14 January 2022 (UTC)
 
== Template-protected edit request on 8 March 2022 ==
 
{{tper|ans=yes}}
<div class="thumb tright"><div class="thumbinner">{{#invoke:InfoboxImage/sandbox|InfoboxImage |image=Mustela erminea upright.jpg |upright=0.5|class=nopageimage}}</div></div>
Please apply the changes made to the module in [[Module:InfoboxImage/sandbox]] ({{Compare pages|{{SUBJECTPAGENAME}}|{{SUBJECTPAGENAME}}/sandbox|diff}}), which adds the option for a "class" parameter that allows upper templates to set an [[Help:Images#Syntax|HTML class]] for the infobox image (particularly the newly-introduced [[mw:Extension:PageImages#Can I exclude certain page images?|"notpageimage" class]], which removes the image from the list of page images). Testcase of working usage of the parameter is shown at the right side (you may need to use the browser's element inspector to verify that the class exists). <span style="background:#ffff55">'''''[[User:Chlod|Chlod]]'''''</span>&nbsp;<small style="font-size:calc(1em - 2pt)">([[User talk:Chlod|say&nbsp;hi!]])</small> 09:47, 8 March 2022 (UTC)
:{{done}} -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 19:18, 13 March 2022 (UTC)
:{{U|Chlod}} I think it would make more sense for this module to provide an API to add the class(es) of interest rather than to provide a class parameter that we'll have to chase the name down should the name ever change. (Or for any other reason.) [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 03:25, 14 March 2022 (UTC)
 
== Help with improving default image sizes  ==
 
A few editors had a contentious but thoughtful discussion about default image sizes in infoboxes that fizzled out due to lack of technical expertise; see [[Template_talk:Infobox_bridge/Archive_2#Image_and_map_widths|this discussion]] from July 2022. It looks like the next step was to post a request for help here. Basically, we thought that this module might be able to do a better job of providing images for infoboxes that followed editors' thumb size preferences so that we could move away from fixed pixel size specifications in infoboxes. If there is anyone here who is willing to look into how we might default to <code>frameless</code> (or whether the module already does this, and how to code infobox image calls properly), I would be grateful. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 01:03, 10 January 2023 (UTC)
 
Ditto. On some other wikis you format the image inside the info box, and can just use 'upright' to size, but on WP-en it's too complicated for me to figure out. It would be nice if at e.g. the language infobox we could set the default to, say, upright=0.9, and editors could override with their own upright value if they chose.
 
Is it possible to set the infobox width to match the user's default image size, or would that be a bad idea? [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 01:45, 10 January 2023 (UTC)
 
:Perhaps I am misunderstanding the discussion or request. There is already a parameter {{para|upright}} to this Module, which is passed along to the <nowiki>[[Image:XXX]]</nowiki> wikitext. If you want an infobox image to default to 114% of the size of a user's preference, why not just set {{para|upright|1.14}} in the infobox code? What am I missing? — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 03:51, 10 January 2023 (UTC)
::In my case, that I don't know what I'm doing with this module! [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 03:53, 10 January 2023 (UTC)
:::Is there a specific infobox we can try to improve? Maybe that will make things clearer (or maybe there will an unanticipated problem and we'll learn from the attempt). — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 03:55, 10 January 2023 (UTC)
::::Yes, thank you. {{tl|Infobox language}}, which I could then extend to Infobox language family. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 03:57, 10 January 2023 (UTC)
:::::Is the idea to default to {{para|upright|0.9}} (~200/220) ? Let's try it in the sandbox. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 03:58, 10 January 2023 (UTC)
::::::Currently, 'image' is set to 90% and 'map' to 100%. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 03:59, 10 January 2023 (UTC)
:::::::Looks like it worked, see [[Template:Infobox language/testcases]]. My default image size is 250px, and it clearly changed for me. It still allows fixed-size overriding, but the default will obey user preferences. Hopefully this will resolve the dispute that seemed to happen at [[Template talk:Infobox bridge/Archive 2]]?
:::::::I'll leave it to other editors to get consensus on this change, but it seems to work technically. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 04:07, 10 January 2023 (UTC)
::::::::Thanks!
::::::::Would it be possible to set it so that if we enter, say, 'mapsize' or 'imagesize=1.25', it will set it as upright=1.25, so we don't have to use px? [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 04:18, 10 January 2023 (UTC)
:::::::::I guess we could check to see if the mapsize is <4, use it as upright? I worry that this will be confusing to editors. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 05:56, 10 January 2023 (UTC)
It looks like using {{para|upright}} will generally work, as shown at [[Template:Infobox bridge/testcases]] (set your thumbnail preference to 300px or higher to see the difference). Somewhere (I forget where, unfortunately), an editor chose to specify an infobox image size to match the pixel size of the mapframe map in the infobox. I don't see a way to apply {{para|upright}} to mapframe maps, so I posted a query [[Template_talk:Infobox_mapframe#How_can_we_scale_the_map_size_to_the_reader's_thumbnail_preference?|at the relevant talk page]]. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 05:04, 10 January 2023 (UTC)
 
:Anything other than a number in mapsize gives the same output, ~ equivalent to entering 500. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 06:25, 10 January 2023 (UTC)
:I've changed the infobox, checking articles. No problems so far. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 06:26, 10 January 2023 (UTC)
:I don't see how |upright= has any effect on anything. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 06:29, 10 January 2023 (UTC)
::{{ping|Kwamikagami}} Have you tried changing your preference for thumbnail size away from 220px? — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 07:09, 10 January 2023 (UTC)
:::No, but I would think that setting upright=2 would be visible regardless. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 07:11, 10 January 2023 (UTC)
::::Oh, I bet I know what this is. This is a limitation in MediaWiki. If you start with a tiny image, it won't blow it up larger than its actual size. What's the example of upright not working? — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 07:14, 10 January 2023 (UTC)
:::::I see that at e.g. [[Malay language]], where the map is an SVG but the nominal size is only 257×190px. And indeed, the English map has a nominal size of 512×260px, which is probably what I was getting when I set the size to anything but a number. But the map at [[Arabic language]] is nominally 1200px, and 'upright' has no effect there either (neither map nor image). [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 07:20, 10 January 2023 (UTC)
::::::I'm a bit confused. [[:File:Arabic albayancalligraphy.svg]] (the example image in the infobox) is 343px, so it won't get bigger than that. [[:File:Arabic speaking world.svg]] is 1200px, but {{para|upright}} appears to work (see below). — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 07:30, 10 January 2023 (UTC)
:::::::Yeah, looks fine here, but no effect in the infobox. I just saved a test edit on that page, in case the preview wasn't working: nothing. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 07:37, 10 January 2023 (UTC)
{{#invoke:InfoboxImage|InfoboxImage|image=File:Arabic speaking world.svg|upright=0.7}}
{{#invoke:InfoboxImage|InfoboxImage|image=File:Arabic speaking world.svg|upright=2}}
::::::::I think there was a misunderstanding. I didn't implement {{para|upright}} in {{tl|Infobox language}}: I just made the default have scalable thumbnails. In [[Template:Infobox language/sandbox]] I implemented {{para|imageupright}} and {{para|mapupright}} to work as you would think, see [[Template:Infobox language/testcases#Test upright]] for the results. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 09:43, 10 January 2023 (UTC)
 
:Ah, thank you. Yes, that works beautifully.
:I changed the labels to 'imagescale' and 'mapscale', as there's been some confusion that 'upright' is only used will tall images. [[User:Kwamikagami|— kwami]] ([[User talk:Kwamikagami|talk]]) 10:39, 10 January 2023 (UTC)
 
== Updated strip marker ==
 
According to [[:mw:Strip marker]], the code for strip markers has changed. You need to replicate [https://ro.wikipedia.org/w/index.php?title=Modul%3AInfoboxImage&diff=15937108&oldid=10663380 this change] in order to get that code to work again. [[User:Strainu|Strainu]] ([[User talk:Strainu|talk]]) 20:58, 20 November 2023 (UTC)
:Implemented in the [[Module:InfoboxImage/sandbox]], but none of the existing tests failed. What is this change supposed to accomplish? Is there a test case where the old code fails and the new one succeeds?  — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 01:15, 21 November 2023 (UTC)
::Yes, the change is supposed to allow {{tl|Multiple images}} to be used with InfoboxImage: see the infobox at [[:ro:Târgoviște]]. From what I can see, [[Template:Multiple images]] has the same implementation as on rowiki, so it's very likely to fail with the old implementation. [[User:Strainu|Strainu]] ([[User talk:Strainu|talk]]) 08:11, 21 November 2023 (UTC)
:::Lines 178-180 already handle the updated format.  It's just that lines 175-178 were not updated previously. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 09:31, 21 November 2023 (UTC)
::::Is it safe to simply delete lines 175-177? — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 12:32, 21 November 2023 (UTC)
:::::Either would work, so I've applied the sandbox change and removed the other check. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 13:27, 21 November 2023 (UTC)
::::::Added a test case using {{tl|Multiple images}} (although it was not failing previously). — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 19:42, 21 November 2023 (UTC)
 
== Explicit option to not add image ==
 
This module is sometimes called by an infobox which passes on an image parameter if it's given in the call and otherwise automatically passes on a Wikidata image. If an article explicitly wants no image then it can pick one of the suppressed image names like <code>image=No image available.png</code> in [https://en.wikipedia.org/w/index.php?title=Batak_Hydropower_Cascade&diff=prev&oldid=1187688731] which uses {{tl|Infobox dam}}. That was hard to work out, later editors of the article may blank the bad looking image parameter in good faith, and I don't know whether the list of suppressed images is certain to never remove a listed image name. I suggest adding a clear and simple value <code>|image=no</code> to not display any image. A blank <code>|image=</code> already does this but as mentioned, that doesn't work in some calls of infoboxes. I came here after working on [[Wikipedia:Teahouse#Technical question about infobox]]. [[User:PrimeHunter|PrimeHunter]] ([[User talk:PrimeHunter|talk]]) 12:09, 1 December 2023 (UTC)
 
:Should all instances of a nested {{tl|Infobox dam}} disable the image? If so, the fix is straightforward in that template. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 12:21, 1 December 2023 (UTC)
 
== Tracking category for URLs in image field ==
 
Discussion: [[Template_talk:Infobox#URLs_in_image_field]]
 
There are probably thousands of URLs in the {{para|image}} field. Would it be possible to add a tracking category? They should be removed on a regular basis and tracking them would be a big help.  -- [[User:GreenC|<span style="color: #006A4E;">'''Green'''</span>]][[User talk:GreenC|<span style="color: #093;">'''C'''</span>]] 20:49, 19 July 2024 (UTC)
 
:Just need to update lines 146, 149, 152, 155, 158 & 161 to return a category. What do you want to call the category? -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 21:33, 19 July 2024 (UTC)
::Does infobox emit tracking categories anywhere else? Following CS1|2 naming, [[:Category:CS1_errors:_archive-url]], it might be [[:Category:Infobox_errors:_image]] a holding cell for all errors related to this module. -- [[User:GreenC|<span style="color: #006A4E;">'''Green'''</span>]][[User talk:GreenC|<span style="color: #093;">'''C'''</span>]] 23:31, 19 July 2024 (UTC)
:::It only emits [[:Category:Pages using infoboxes with thumbnail images]] at the moment. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 06:19, 20 July 2024 (UTC)
::::That's a standard error category format. I would suggest [[:Category:Pages using infoboxes with URL in image field]]. — [[User:Hike395|hike395]] ([[User talk:Hike395|talk]]) 12:03, 20 July 2024 (UTC)
:::::Let's use the word "parameter" instead of "field", since that is the term here on Wikipedia, or just leave off the last word entirely: "Pages using infoboxes with URL in image". – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 13:52, 20 July 2024 (UTC)
:Done: [[Special:Diff/1186186161/1236046032]] for [[:Category:Pages using infoboxes with URL in image parameter]] - I included "parameter" or it could be ambiguous, such as a URL displayed ''in'' the image, which might be a concern due to spam. -- [[User:GreenC|<span style="color: #006A4E;">'''Green'''</span>]][[User talk:GreenC|<span style="color: #093;">'''C'''</span>]] 16:02, 22 July 2024 (UTC)
::There are currently around 1.1k pages in the category. A bot can easily remove the usages. I wonder if a bot could also upload the image from the file and set it (if we want to use those images). Checking each page individually, seems tedious for something that no one cared to fix until now. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 13:34, 7 August 2024 (UTC)
:::Uploading images (automatically) is impossible due to copyright and descriptive issues. Simply deleting any URL found in the field is the correct action. The deletion is easy, the harder aspect is what the parameter names are to target. There are so many variations.  -- [[User:GreenC|<span style="color: #006A4E;">'''Green'''</span>]][[User talk:GreenC|<span style="color: #093;">'''C'''</span>]] 14:17, 7 August 2024 (UTC)
::::If it's a good-faith, but malformed, attempt to bring in an existing image hosted on Commons or English Wikipedia, such as <syntaxhighlight lang=wikitext>|image=https://en.wikipedia.org/wiki/File:Example.jpg</syntaxhighlight> or <syntaxhighlight lang=wikitext>|image=https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg</syntaxhighlight> I think we should not delete the link outright, but fix it up as in <syntaxhighlight lang=wikitext>|image=Example.jpg</syntaxhighlight> with preview before save to ensure that it's a suitable image for the context. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] &#x1f339; ([[User talk:Redrose64|talk]]) 20:52, 7 August 2024 (UTC)
:::::Yeah good point could check. Do you know a way to determine what template parameter names the module is used in? We know of {{para|image}}, there are probably dozens of others. Need to know for parsing. -- [[User:GreenC|<span style="color: #006A4E;">'''Green'''</span>]][[User talk:GreenC|<span style="color: #093;">'''C'''</span>]] 21:49, 7 August 2024 (UTC)
::::::There are about 1,000 pages in the category right now. I expect that if you scanned for {{para|image}} and {{para|logo}}, you would get 90% of them, and then we could see what other parameters are being used. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 22:23, 7 August 2024 (UTC)

Latest revision as of 15:59, 24 January 2026

Template:Permanently protected Template:Talk header User:MiszaBot/config Template:Archives

Other size parameters cause upright to be ignored

With the current implementation of this module, the upright parameter is ignored if the maxsize or sizedefault parameters are defined. This appears to be because image syntax ignores upright if a size in pixels is defined. It means that if either of those parameters are used in an infobox template (see {{Infobox bridge}} for example), then it's not possible to use the upright parameter at all in articles, which is not the intended behavior.

I don't have the Lua skills to do so, but I think the module should be rewritten so that a pixel size is not passed if the upright parameter is used and the size parameter is not. Pi.1415926535 (talk) 03:27, 30 May 2025 (UTC)

I think there are two separate cases to consider:
  1. Both |upright= and either |maxsize= or |sizedefault= are specified
  2. Both |upright= and |size= are specified
In the first case, I think the current module behavior is likely incorrect -- the caller specified a size via |upright= and it's being handled as if no size was specified. The second case is less clear, because conflicting sizes are being provided. I'm reluctant to change the current behavior for the second case, because there may be unintended consequences to the 5M articles that use this module.
Of course, fixing the incorrect behavior also may have unintended consequences, also, so we should be careful. For example, the proposed behavior now allows people to set absurd values to |upright= and there is no check or limit.
I've modified the sandbox to fix the first issue, and updated the tests to exercise the new code. Template:Pinging to see if they have any comments on the change: other editors are also welcome to comment. — hike395 (talk) 09:17, 30 May 2025 (UTC)
Later: I added some logic to ensure that |upright= doesn't produce an image larger than |maxsize=, assuming the default user preference. This fixes one potential issue. Updated sandbox and testcases. I'm hoping some other templateeditor or admin takes a look at the diff. — hike395 (talk) 10:01, 30 May 2025 (UTC)
@Hike395: Thanks for looking into this! Just to clarify - will this still allow an image scaled with upright to be larger than maxsize if the user preference is set to a larger-than-default value? That seems important for accessibility reasons. Pi.1415926535 (talk) 16:09, 30 May 2025 (UTC)
Yes: if upright is specified, then maxsize will scale with the user's default image size. So if maxsize=300, and the user's preferred thumbnail size is set to 300px, then the output image will be limited to be less than 300*300/220 = 409px for that user. There's no way to avoid this. — hike395 (talk) 00:39, 31 May 2025 (UTC)
Great, that is the behavior I believe it should have. Pi.1415926535 (talk) 00:45, 31 May 2025 (UTC)
To the original observation Template:Tq: this is expected behaviour, and is documented at WP:PICSIZE, inside the "Implementation details" box (direct link), last paragraph. --Redrose64 🌹 (talk) 13:39, 31 May 2025 (UTC)
Template:Ping Picking this back up. My sandbox edits do not contradict WP:PICSIZE. If a absolute size and an upright are both specified, then the absolute size is used. What I did was scale maxsize and sizedefault relative to the user preferred image size. Those two parameters are only defined in this module: WP:PICSIZE does not discuss them.
Is it ok to promote the sandbox to main? I see that since this edit, Pi.14 has removed maxsize and sizedefault from a number of infoboxes. It would be good to restore those, if I can promote sandbox to main. — hike395 (talk) 08:48, 5 August 2025 (UTC)
Template:Ping Any comments or thoughts before I propose this as an edit? Template:U just fully protected this Module, so I can no longer edit it, so even a simple support/agree would be helpful. — hike395 (talk) 14:46, 12 August 2025 (UTC)
To be clear, my full protection was completely unrelated to this dispute, which I didn't even know existed; if you look at my edits at the time I adjusted the protection level of hundreds of templates. * Pppery * it has begun... 17:35, 12 August 2025 (UTC)
If I'm understanding correctly what your edit does, I support it. I'm confused about your statement Template:Tq - to my knowledge, I haven't edited any infobox templates to remove these. Pi.1415926535 (talk) 05:12, 13 August 2025 (UTC)
Template:Ping apologies. I didn't mean to imply causation here -- I just wanted to point out that I can no longer edit the template directly.
Template:Ping more apologies. I recall seeing edits to infoboxes which removed maxsize and sizedefault, but now I cannot find them to check who did them. — hike395 (talk) 12:33, 13 August 2025 (UTC)

Edit request

Template:FPER Please copy Module:InfoboxImage/sandbox to Module:InfoboxImage

This is a change in handling the case where |upright= and either |maxsize= or |sizedefault= is specified. In this case, the sandbox version obeys |upright=, but if it exceeds maxsize/220, then it is set to maxsize/220. The current behavior is to ignore |upright= when either |maxsize= or |sizedefault= is specified, which is incorrect.

This edit does not change any behavior if |upright= is not specified. Also, if |size= and |upright= are both specified, the behavior remains unchanged: |size= is obeyed in that case.

Are you sure that this description is correct? On the testcases page, I am seeing the Mustela image with <syntaxhighlight>upright=1.5|sizedefault=272|maxsize=300</syntaxhighlight>. The live module renders the image at 1.5x my thumbnail size. The sandbox image is rendered at 272px. This seems to be the opposite of the description above, if I am reading it correctly. It also seems to be a fix that helps the module to match normal image rendering (px is preferred over upright). Is this what you want? – Jonesey95 (talk) 17:01, 15 August 2025 (UTC)
You may be interpreting the unit tests backward? Here are the results when main and sandbox are called with the case that you are highlighting:
{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|sizedefault=272|maxsize=300}}

File:Mustela erminea upright.jpg

{{subst:#invoke:InfoboxImage/sandbox|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|sizedefault=272|maxsize=300}}

File:Mustela erminea upright.jpg

Here, the main module is generating a pic with size=272px, while the sandbox module is generating a pic with upright=1 (rendered at your preferred size). So the logic is correct.
The logic has not changed when both size and upright are specified. They are both emitted and MediaWiki prefers size over upright:
{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|size=200}}

File:Mustela erminea upright.jpg

{{subst:#invoke:InfoboxImage/sandbox|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|size=200}}

File:Mustela erminea upright.jpg

hike395 (talk) 17:18, 15 August 2025 (UTC)
Indeed, I do not understand what "Expected" and "Actual" refer to on that page. I'm used to seeing the live template followed by the sandbox, with appropriate headers to match. In that case, and based on the apparent consensus above, I have no objections. It looks like this change will require an administrator, which I am not. – Jonesey95 (talk) 17:25, 15 August 2025 (UTC)
Template:Ping Do you object to this request? * Pppery * it has begun... 19:48, 15 August 2025 (UTC)
I'm not a Lua expert, and have never claimed to be. --Redrose64 🌹 (talk) 22:18, 16 August 2025 (UTC)

Template:Done * Pppery * it has begun... 04:35, 17 August 2025 (UTC)

Default maxsize to 250px

I’ve recently been coming across a lot of Infoboxes with substatially large images in their infoboxes. 300-400px in size. Can we modify this module to default to a <syntaxhighlight lang="text" class="" style="" inline="1">maxsize</syntaxhighlight> of 250px? If for some reason a particular infobox wants to override that, that’s another matter, but that way we can at least cut down on the number of large images? If there is no objection to this change, I’m happy to write the code in the sandbox and do a formal edit request. Zackmann (Talk to me/What I been doing) 07:37, 30 September 2025 (UTC)

A few comments:
  1. I would be extremely cautious about setting defaults in this template. It's used on 5M pages and in system messages. The probability of unintended consequences is high.
  2. Looking at the usage of |sizedefault=, I see many templates use |sizedefault=frameless. With the current code, such a default will ignore maxsize.
  3. Looking at the usage of |maxsize=, many templates set maxsize larger than 250px. The largest ones appear to be 325px. To be conservative, the default maxsize should set to a high value (e.g., 325px). I think, however, it would be safer not to have a default maxsize.
hike395 (talk) 10:11, 30 September 2025 (UTC)
We should not standardize on a pixel size, per MOS:IMGSIZE (Template:Tq). See the discussion above, which proposes to somehow default to the viewer's preferred thumbnail size, and the 2022 discussion that led to the one above. – Jonesey95 (talk) 10:44, 30 September 2025 (UTC)
Per Template:Diff, setting |maxsize= does not standardize on a pixel size. If we do set |maxsize=250, then it limits |size= to 250 and limits |upright= to 1.136. px is not forced or favored in any way.
Also -- I just cleaned up all uses of |sizedefault=frameless, so that is no longer a factor in any decision. — hike395 (talk) 13:52, 30 September 2025 (UTC)
Thanks for both of those. Based on the above discussion, which I had forgotten about because I got so mixed up, it looks like the sizedefault of frameless will override the maxsize as long as size= is not specified. I tested sizedefault=frameless|maxsize=250 in my sandbox and got a 300px image, which is the same as my thumbnail preference. If I set sizedefault=frameless|maxsize=250|size=100, I get a 100px image. Based on that, it looks like a sizedefault maxsize of 250px would prevent images from getting larger than the editor's preferred thumb size unless size= is specifically set. Caveat: I might not be testing all possible cases. – Jonesey95 (talk) 14:12, 30 September 2025 (UTC)
To clarify: the behavior with |sizedefault=frameless is a bug. Maybe I should fix the bug rather than cleaning up occurrences of |sizedefault=frameless, although fixing the bug would add 3 lines of special-purpose code for that case.
To see the correct behavior, if you try maxsize=250 you should get 250px, if you try upright=1|maxsize=250 you should get 300px, while if you try upright=1.5|maxsize=250 you should get 340px (limited by maxsize). — hike395 (talk) 14:44, 30 September 2025 (UTC)
Yeah, now I'm confused again.
  • When I set maxsize=250, I get 250px (my thumb size is 300px, and I thought sizedefault=frameless was being set by default, so I was expecting 300px).
  • When I set |upright=1|maxsize=200, I get 270px (about 137% of maxsize, so it doesn't match maxsize or the upright setting).
  • When I set |upright=1|maxsize=250, I get 300px (my thumb size preference; this seems correct).
  • When I set |upright=1|maxsize=300, I get 300px (my thumb size preference; this seems correct).
  • When I set |upright=1.5|maxsize=300, I get 412px (about 137% of maxsize and my thumb size, so it doesn't match maxsize or the upright setting).
The code I am using in a Preview window in my sandbox looks like <syntaxhighlight inline lang=wikitext>{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|maxsize=300}}</syntaxhighlight>. Somebody please explain it to me like I'm not very smart. – Jonesey95 (talk) 16:22, 30 September 2025 (UTC)
The maxsize parameter is to limit the value of the size parameter. Normally in an infobox template you would have <syntaxhighlight inline lang=wikitext>image = {{subst:#invoke:InfoboxImage|InfoboxImage|image=|size={{{image_size}}}|maxsize=300}}</syntaxhighlight> and then when used on an article with <syntaxhighlight inline lang=wikitext>Template:Infobox something</syntaxhighlight>, the image size would be limited to 300. -- WOSlinker (talk) 18:26, 30 September 2025 (UTC)

Template:Od To understand the behavior, see the discussion above. The maximum size (in px) for InfoboxImage when upright is specified is (maxsize/220)*(your thumbnail preference).

When you set maxsize=200, you are saying that the max upright is 200/220 = 0.909, which is 272px.
When you set maxsize=250, you are saying that the max upright is 250/220 = 1.136, which is 341px. Upright=1 thus gives 300px for you.
When you set maxsize=300, you are saying that the max upright is 300/220 = 1.364, which is 409px for you. Upright=1 thus gives 300px, but upright=1.5 gets limited to 1.364 which is 409px.

The 220 comes from the default user thumbnail size. Hope this helps. — hike395 (talk) 22:37, 30 September 2025 (UTC)

Here is an example of what a default <syntaxhighlight lang="text" class="" style="" inline="1">maxsize</syntaxhighlight> would help prevent… - Zackmann (Talk to me/What I been doing) 01:06, 1 October 2025 (UTC)
Template:Ping sorry for the bad news, but that article uses {{Infobox royalty}} that already has |maxsize=300. Adding a default maxsize would do anything in this case. What this module produces with that input is [[File:Olu Atuwatse I Dom Domingos.jpg|300x|upright=1]]. The "300x" is a syntax error, so the Wiki image markup just displays the image at full resolution (which is 5286x4119px).
We could attempt to harden the output of the module so that junk doesn't "leak through". This is separate from maxsize. — hike395 (talk) 02:46, 1 October 2025 (UTC)
Template:Ping I added the |maxsize=300 Template:Diff as a result of finding that page. But good to know that maxsize wouldn’t have prevented it. Template:SmileyZackmann (Talk to me/What I been doing) 02:49, 1 October 2025 (UTC)
Continuing from Template talk:Infobox settlement#Max size :) My Special:Preferences#mw-prefsection-rendering-files says 250px, and I don't remember having changed this myself.
So the use of 220 in this module needs to be abstracted away into some sort of a variable, because it looks like this isn't making a lot of sense otherwise. --Joy (talk) 10:18, 17 October 2025 (UTC)
And if Wikipedia:Image use policy#Displayed image size tells editors Template:Tq, then this module should also support relative sizes as well, instead of forcing this sort of pixel-based thinking from editors. --Joy (talk) 10:20, 17 October 2025 (UTC)
The default thumbnail size used to be 220px but changed to 250px in April 2025. See Wikipedia:Tech_news/Archive_13#Tech_News:_2025-16. -- WOSlinker (talk) 17:59, 17 October 2025 (UTC)

Edit request 17 October 2025

Template:FPER Please copy the sandbox to main.

Two changes:

  1. (technical) --- factored out list of placeholder images and tracking categories into Module:InfoboxImage/data to neaten beginning of module
  2. (substantive) --- per discussion above, the systemwide default thumbnail size is now 250px. Factored this value out of existing code and turned it into constant at beginning of module. This introduces two expected "errors" into the test cases.

Template:Pinging who brought this up. — hike395 (talk) 02:28, 18 October 2025 (UTC)

Template:Done -- WOSlinker (talk) 09:46, 18 October 2025 (UTC)

UPDATE PROFILE IMAGE

Template:Edit fully-protected Please change the profile photo to the following image https://commons.wikimedia.org/wiki/File:Walter_Masterson.jpg Wikispiraling (talk) 23:54, 24 November 2025 (UTC)

Template:Ping This page is for discussions concerning use and development of the module Module:InfoboxImage. I can only assume that you are intending to ask for the image you have mentioned to be put in the article Walter Masterson; if so the request belongs in the talk page of whatever article that is, not here. JBW (talk) 00:04, 25 November 2025 (UTC)

Discussion at Template talk:MergedMap

File:Symbol watching blue lashes high contrast.svg You are invited to join the discussion at Template talk:MergedMap. -- Joy (talk) 12:48, 27 November 2025 (UTC)

Captions

Is there a reliable way to get captions from wikidata? I don't think this module deals with captions at all, which is surprising. We have an issue on Template:Infobox martial artist where the caption is not always matching the image. This module was using the preferred image but Module:Wikidata was taking the caption from a different image — Martin (MSGJ · talk) 09:23, 6 January 2026 (UTC)

That infobox is checking the image and caption params independently.
<syntaxhighlight lang="wikitext">

Script error: No such module "Wikidata". Script error: No such module "Wikidata". </syntaxhighlight>

Maybe needs to check both params are empty before using any wikidata values?
<syntaxhighlight lang="wikitext">

Script error: No such module "Wikidata". Script error: No such module "Wikidata". </syntaxhighlight>

WOSlinker (talk) 10:04, 6 January 2026 (UTC)