Template talk:Flagicon image

Requested edit: forcing width
Please replace the contents of the template from:



(line break added for legibility) to:



(again, please remove the line breaks, which I have added for legibility).

This will force flags to be the same width as standard flagicon images, unless size is specified. Thanks! — OwenBlacker (Talk) 15:59, 9 July 2012 (UTC)
 * . Per Template:Flagicon/core, the default width for the flagicon template (22x20px) is already the default width here.  For example:
 * 🇬🇧
 * These look identical on my browser. Indeed, if you look at the output of Special:ExpandTemplates you get nearly identical markup, the only difference being the image link and alt text:
 * Flag of the United Kingdom.svg
 * Flag of the United Kingdom.svg
 * — Andrwsc (talk · contribs) 18:04, 9 July 2012 (UTC)
 * — Andrwsc (talk · contribs) 18:04, 9 July 2012 (UTC)


 * Sorry, I should have been clearer. The problem is not with the normal cases, like the UK flag, but with flag images that are portrait or square in orientation, such as the Heraldic banner of Spain at File:Pendón heráldico de los Reyes Catolicos de 1475-1492.svg.
 * If you look at Italian War of 1494–1498, excerpted to the right here, you can see the text lining up in the right-hand column of the infobox for "Kingdoms of Spain" and "Duchy of Milan", where I have applied this span manually, but not for "Papal States", where I have not. The "Duchy of Mantua" text lines up fine, because that flag is landscape-oriented.
 * The change I'm proposing should make no difference at all to landscape-orientated flags, but will fix that alignment issue for square flags and portrait flags. An alternative, if you're still not convinced, might be to add another parameter to make such a span be optimal, but then it's more likely to be forgotten and leave misalignment across articles. — OwenBlacker (Talk) 15:09, 10 July 2012 (UTC)
 * If it lines up for you, then it needs more testing because it is off by 1 pixel here (Firefox 10.0.5). Also, if this is really an issue, then perhaps the solution should be applied to the other flagicon-inserting templates as well. Anomie⚔ 21:11, 10 July 2012 (UTC)
 * If it lines up for you, then it needs more testing because it is off by 1 pixel here (Firefox 10.0.5). Also, if this is really an issue, then perhaps the solution should be applied to the other flagicon-inserting templates as well. Anomie⚔ 21:11, 10 July 2012 (UTC)

Proposed fix if empty
I have created a sandbox version ([//en.wikipedia.org/wiki/Special:ComparePages?rev1=563552128&rev2=636809549 compare]) which better deals with cases in which the first parameter is empty or not defined at all. The latter is currently the case at List of micronations, where many non-free image names were recently semi-automatically commented out, leaving ugly bordered transparent flag images. It's even worse if the first parameter is kept but emptied, which results in wikitext being displayed. The sandbox displays an unbordered transparent image in both cases.

Please update the template from the sandbox or, preferably, reduce to template protection so I can do it myself. SiBr4 (talk) 22:25, 5 December 2014 (UTC)
 * I lowered the template's protection. Cheers, LittleMountain5 21:52, 7 December 2014 (UTC)
 * Now done. SiBr4 (talk) 08:51, 8 December 2014 (UTC)

No borders alt text
Why do flags with no borders when using "border=no" in the template display the alt text, when hovering over the image, "no" - FugeeCamptalk 00:34, 14 November 2015 (UTC)
 * The border parameter should be empty, not "no", to deactivate the border; e.g. . A non-empty string as value for the parameter does remove the border, but as a side effect adds the value as mouseover for the image. This is consistent with the back-end "border" parameters in other flag templates. I'll clarify the documentation, though changing the template to accept "no" would also be possible. SiBr4 (talk ) 09:14, 14 November 2015 (UTC)
 * The sandbox now uses a yesno-based switch for the border, allowing any string for border. It interprets ""/"no"/"n"/"0"/"false" as no border and anything else as border:
 * {| class="wikitable" style="text-align:center;"

! Param !! Current !! Sandbox
 * || |23x15px || |23x15px
 * style="text-align:left;"|border= || |23x15px || |23x15px
 * style="text-align:left;"|border=yes || |23x15px || |23x15px
 * style="text-align:left;"|border=1 || |23x15px || |23x15px
 * style="text-align:left;"|border=no || |23x15px || |23x15px
 * style="text-align:left;"|border=0 || |23x15px || |23x15px
 * style="text-align:left;"|border=foo || |23x15px || |23x15px
 * }
 * SiBr4 (talk ) 09:40, 14 November 2015 (UTC)
 * I guess this never made it out of the sandbox, as I'm still seeing this issue: border=no ends up as img title="no" Random fixer upper (talk) 09:26, 18 February 2023 (UTC)
 * style="text-align:left;"|border=0 || |23x15px || |23x15px
 * style="text-align:left;"|border=foo || |23x15px || |23x15px
 * }
 * SiBr4 (talk ) 09:40, 14 November 2015 (UTC)
 * I guess this never made it out of the sandbox, as I'm still seeing this issue: border=no ends up as img title="no" Random fixer upper (talk) 09:26, 18 February 2023 (UTC)
 * SiBr4 (<span title="User talk:SiBr₄">talk ) 09:40, 14 November 2015 (UTC)
 * I guess this never made it out of the sandbox, as I'm still seeing this issue: border=no ends up as img title="no" Random fixer upper (talk) 09:26, 18 February 2023 (UTC)

Links
I would like to suggest that this template is expanded with an optional link= parameter so that the produced image can be configured to link to a relevant article when clicked on, just like with the regular flagicon template.Tvx1 18:02, 3 February 2019 (UTC)
 * - alright, this is a good case to work on. I've tried some sandbox experimentation, but can't seem to figure it out. I often copy code from other templates but can't find a precedent here off the top of my head. ɱ  (talk) 06:10, 9 May 2020 (UTC)
 * OK, I added code to the sandbox that should allow for a link parameter (click the "diff" link at the bottom of the template documentation to see the new code). Now create a testcases page using testcase table to demonstrate its usage. It may be easiest to copy an existing testcases page. If you get stuck, let me know. – Jonesey95 (talk) 14:56, 9 May 2020 (UTC)
 * Thanks, will take a look! ɱ  (talk) 01:21, 10 May 2020 (UTC)
 * This task is ✅. ɱ  (talk) 01:27, 10 May 2020 (UTC)