| Module:InfoboxImage is indefinitely protected from editing as it is a heavily used or highly visible module. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit protected}} to notify an administrator to make the requested edit.
|
| This is the talk page for discussing improvements to the InfoboxImage module. |
|
| Archives: 1, 2, 3, 4Auto-archiving period: 12 months |
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)
|upright= and either |maxsize= or |sizedefault= are specified|upright= and |size= are specified|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.|upright= and there is no check or limit.|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)
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 (direct link), last paragraph. --Redrose64 🌹 (talk) 13:39, 31 May 2025 (UTC)
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. Pi.1415926535 (talk) 05:12, 13 August 2025 (UTC)
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
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.
upright=1.5|sizedefault=272|maxsize=300{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|sizedefault=272|maxsize=300}} →{{subst:#invoke:InfoboxImage/sandbox|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|sizedefault=272|maxsize=300}} →{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|size=200}} →{{subst:#invoke:InfoboxImage/sandbox|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|size=200}} →
Done * Pppery * it has begun... 04:35, 17 August 2025 (UTC)
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 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. Zackmann (Talk to me/What I been doing) 07:37, 30 September 2025 (UTC)
|sizedefault=, I see many templates use |sizedefault=frameless. With the current code, such a default will ignore maxsize.|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.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 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)
|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.|sizedefault=frameless, so that is no longer a factor in any decision. — hike395 (talk) 13:52, 30 September 2025 (UTC)
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=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.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)
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).|upright=1|maxsize=200, I get 270px (about 137% of maxsize, so it doesn't match maxsize or the upright setting).|upright=1|maxsize=250, I get 300px (my thumb size preference; this seems correct).|upright=1|maxsize=300, I get 300px (my thumb size preference; this seems correct).|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).{{subst:#invoke:InfoboxImage|InfoboxImage|image=Mustela erminea upright.jpg |upright=1|maxsize=300}}. Somebody please explain it to me like I'm not very smart. – Jonesey95 (talk) 16:22, 30 September 2025 (UTC)
image = {{subst:#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size}}}|maxsize=300}} and then when used on an article with {{Infobox something|image=abc.jpg|image_size=500}}, the image size would be limited to 300. -- WOSlinker (talk) 18:26, 30 September 2025 (UTC)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).
The 220 comes from the default user thumbnail size. Hope this helps. — hike395 (talk) 22:37, 30 September 2025 (UTC)
maxsize would help prevent… - Zackmann (Talk to me/What I been doing) 01:06, 1 October 2025 (UTC)
|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).|maxsize=300 here as a result of finding that page. But good to know that maxsize wouldn’t have prevented it. 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. --Joy (talk) 10:20, 17 October 2025 (UTC)
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Please copy the sandbox to main.
Two changes:
Pinging @WOSlinker who brought this up. — hike395 (talk) 02:28, 18 October 2025 (UTC)
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
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)
You are invited to join the discussion at Template talk:MergedMap. -- Joy (talk) 12:48, 27 November 2025 (UTC)
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)
{{if empty|{{{image|}}}|{{#invoke:Wikidata|claim|P18}}}}
{{if empty|{{{caption|}}}|{{#invoke:Wikidata|getImageLegend|FETCH_WIKIDATA}}}}
{{#ifeq:{{{image|}}}{{{caption|}}}||{{#invoke:Wikidata|claim|P18}}|{{{image|}}}}}
{{#ifeq:{{{image|}}}{{{caption|}}}||{{#invoke:Wikidata|getImageLegend|FETCH_WIKIDATA}}|{{{caption|}}}}}
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Please remove the images.it is misleading it's not real.thanks Abidthegreat (talk) 07:28, 26 March 2026 (UTC)
I would like to propose a comprehensive update to Module:InfoboxImage and its data submodule Module:InfoboxImage/data. The goal is to improve performance (especially on long articles with multiple infoboxes), fix a silent bug regarding alt text validation, and structure the data layer according to Lua best practices in MediaWiki.
I have prepared and tested the updated code in the local sandboxes. Here is a breakdown of the key improvements:
The sandboxes have been cross-verified against multiple test cases (bare filenames, fully formatted `File:...` links, raw URLs, templates, and strip markers). The output markup is identical to the current production version, but executes with significantly less processing overhead.
Please let me know if there are any objections or feedback before I submit an official Edit Request. Thanks!
GKNishimoto (talk) 13:39, 4 June 2026 (UTC)
A couple of things to note:
mw.loadData already caches the data load once per module load (see [1]), so there's no need for the new code at sandbox lines 23-26.Because of these, my preference is to perform mw.loadData locally within each function. This performs lazy evaluation of loadData -- it's not loaded until its needed. For this module, the lazy load occurs 100% of the time, so it isn't critical at this time. But if someone changes the code in the future, lazy loading could be helpful. If you always load the module at lines 23-26, then you'll always incur the Lua parsing overhead for the data.
The conversion of Module:InfoboxImage/data to use a hash table directly is nice, although won't help performance. Because the time is dominated by Lua parsing, the conversion of the list to a hash (which only happens once one module load) will not be noticable.
Also: please don't remove comments from the code. They're helpful for future developers.
— hike395 (talk) 15:08, 4 June 2026 (UTC)
mw.loadData('Module:InfoboxImage/data/sandbox') has been moved locally inside trackingCat and i.IsPlaceholder. This ensures that the data layer is only processed when actually needed, preventing unnecessary overhead if the module's scope changes in the future.Hello. How can I display a logo in an infobox with its original dimensions? For example this: File:2027 FIBA Women's AmeriCup logo.webp
This is a quite small logo, so I don't want to upscale it to the default 250px. I tried something: |size=x270px but that's completely wrong...
Thank you for your ideas. Maiō T. (talk) 21:42, 15 June 2026 (UTC)
|size=auto or something similar... Maiō T. (talk) 09:30, 16 June 2026 (UTC)
{{Infobox international basketball competition}}, the |size= parameter (which is an alias for |image_size=) must be an integer; values containing units, such as |size=x270px, are ignored. Since the native size of File:2027 FIBA Women's AmeriCup logo.webp is 177 × 270 pixels, and you want it 270px high, simply set |size=177. --Redrose64 🌹 (talk) 12:09, 16 June 2026 (UTC) --Redrose64 🌹 (talk) 12:09, 16 June 2026 (UTC)
if nativesize<250 then infoboxsize=nativesize otherwise infoboxsize=250 or something (translated into module language). Maiō T. (talk) 17:35, 16 June 2026 (UTC)
|size=177 more inconvenient than |size=x270px? --Redrose64 🌹 (talk) 21:33, 16 June 2026 (UTC)
|size=177 is inconvenient, because I have to find this exact non-round number on the page of that specific image. Actually, |size=x270px was inconvenient too. My idea is to not write the size number at all. Maiō T. (talk) 22:10, 16 June 2026 (UTC)
|size=orig, and it works! The logo is displayed in its native size... Did you personally make any changes to the module? Maiō T. (talk) 19:12, 12 July 2026 (UTC)
|size=x270px to |size=orig, all you have done is exchange one invalid value for another. As I noted above, this parameter is documented as accepting an integer and nothing else is valid. Why did you not simply set |size=177 as you were advised? --Redrose64 🌹 (talk) 19:19, 12 July 2026 (UTC)
Standard WP image syntax will not enlarge an image if it has a caption (see WP:PICSIZE). The code at {{Infobox international basketball competition}} had some silly defaults that did nothing except break this feature. I fixed the Infobox code and added a caption at 2027 FIBA Women's AmeriCup, and behold: the image now displays at its original size. — hike395 (talk) 01:32, 14 July 2026 (UTC)
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.