Template talk:Main page image/TFA

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Request update[edit]

Please copy the version in the sandbox. This is a minor change to allow unnamed parameters. --- C&C (Coffeeandcrumbs) 23:19, 16 August 2020 (UTC)[reply]

Done. Jo-Jo Eumerus (talk) 08:00, 28 August 2020 (UTC)[reply]

Thumbtime[edit]

@Wehwalt and/or @Jimfbleak: Can any of you coordinator + administrator please add that | thumbtime = parameter? I need it for Wikipedia:Today's featured article/requests/Draft Eisenhower movement. It was previously implemented in Template:Main page image/DYK (See Special:Diff/1052927417) – Kavyansh.Singh (talk) 20:25, 29 January 2022 (UTC)[reply]

Templates aren't my thing. Possibly someone more technically versed can deal with it.--Wehwalt (talk) 22:04, 29 January 2022 (UTC)[reply]
Nor me, I'm afraid Jimfbleak - talk to me? 11:53, 30 January 2022 (UTC)[reply]

Adding the thumbtime parameter[edit]

For Wikipedia:Today's featured article/requests/Draft Eisenhower movement, I need to set the thumbtime for the video file. Please see WP:THUMBTIME for the use of that parameter. The same change was implemented in {{Main page image/DYK}} a few days ago, see Special:Diff/1052927417. In this template, below | alt = {{{alt|}}}, please add | thumbtime = {{{thumbtime|}}}, and reflect the same change in the documentation as well. Thanks! – Kavyansh.Singh (talk) 13:03, 30 January 2022 (UTC)[reply]

I've added the parameter. Please update the documentation, thanks — Martin (MSGJ · talk) 12:59, 31 January 2022 (UTC)[reply]
Thanks! I have updated the documentation. – Kavyansh.Singh (talk) 13:17, 31 January 2022 (UTC)[reply]

pagename[edit]

Martin, is there a reason why the {{remove file prefix}} template was replaced with the "PAGENAME" magic word in this edit? i believe this may have, in certain cases, broken the code used to resize the image. specifically, what "PAGENAME" returns does not appear to be formatted correctly for the "main page image" module when the filename of the image contains either the ampersand character ('&'), the semicolon character (';'), the quotation mark character ('"'), or the apostrophe character ('''). it is possible that there are other points of failure; i admittedly have yet to test the code extensively. i am checking with you because i didn't want to revert the edit unilaterally in case i ended up breaking something else myself.

note that i am not sure if simply reverting this edit would fix the situation, as {{remove file prefix}} has since also been edited to use "PAGENAME". also, i assume that similar edits to {{main page image/ITN}}, {{main page image/DYK}}, {{main page image/OTD}}, and {{TFLcontent}} have resulted in similar issues. dying (talk) 22:59, 29 February 2024 (UTC)[reply]

If Template:Remove file prefix also uses the PAGENAME method then that suggests that the issue is not with PAGENAME, and reverting that change would have zero effect. Can you give an actual example of what is going wrong? — Martin (MSGJ · talk) 10:57, 1 March 2024 (UTC)[reply]
Martin, {{remove file prefix}} used to not use "PAGENAME". this edit to {{main page image/TFA}} was made before this edit to {{remove file prefix}}. below is a table with 28 examples of affected images in tfa blurbs from 2022 and 2023. note that all the images are presented below with the {{main page image/TFA}} template, so the thumbnails are all 140 pixels wide as of this writing, but should appear with varying widths if the bug is addressed correctly.
no. date blurb image filename
1 2022.01.18 blurb
White men and Robeson County indians (Lumbee Indians) in fight-armed skirmish (State's Exhibit No.6). Photo taken by Bill Shaw, Fayetteville Observer newspaper photographer. Photo used as state's (8224422682).jpg
2 2022.02.09 blurb
Lunar Module-1 and Spacecraft Lunar Module Adapter (SLA)-7 in the Kennedy Space Center's Manned Spacecraft Operations Building.jpg
3 2022.03.08 blurb
Coke's Hartebeest.jpg
4 2022.03.14 blurb
Rubik's cube.svg
5 2022.04.08 blurb
Yuji Naka' - Magic - Monaco - 2015-03-21- P1030036 (cropped).jpg
6 2022.04.19 blurb
French's Concord Minuteman statue (cropped).jpg
7 2022.06.22 blurb
Portrait of Henry, Duke of Lancaster - William Bruges's Garter Book (c.1440-1450), f.8 - BL Stowe MS 594 (cropped).jpg
8 2022.08.16 blurb
Illustration from 1676 article on Ole Rømer's measurement of the speed of light.png
9 2022.11.09 blurb
The visitors' end at Priestfield Stadium - geograph.org.uk - 2102661.jpg
10 2022.12.03 blurb
Kalki Koechlin unveils Nokia Lumia 820 & 920 mobile (cropped).jpg
11 2023.01.07 blurb
Charles d'Anjou comte de Provence.jpg
12 2023.01.28 blurb
Bundesarchiv DVM 10 Bild-23-61-23, Linienschiff "SMS Rheinland".jpg
13 2023.03.08 blurb
Eunice Foote - "Circumstances Affecting the Heat of the Sun's Rays" (1856).png
14 2023.03.24 blurb
Lossy-page1-2658px-Nelson's Pillar, Sackville-Street, Dublin RMG PU3914 (cropped).jpg
15 2023.04.18 blurb
P&W 4006 Baltic CT.jpg
16 2023.04.24 blurb
Ambassador Morgenthau's Story p314.jpg
17 2023.05.01 blurb
Ronnie O'Sullivan PHC 2011-2.png
18 2023.07.01 blurb
Meghan Trainor - Macy's 2014.jpg
19 2023.07.10 blurb
St Michael's Alley (49634098776) (Cropped).jpg
20 2023.07.23 blurb
Johan Doppelmayr's celestial chart of Pavo and Indus (cropped).jpg
21 2023.08.01 blurb
"The man wot eats oysters - But can't pay for 'em".png
22 2023.08.02 blurb
Tamar Braxton V-100 Meet & Greet.jpg
23 2023.08.19 blurb
Dinar of al-Mu'izz li-Din Allah, AH 343.jpg
24 2023.09.21 blurb
Front Quad, The Queen's College.jpg
25 2023.10.22 blurb
Price's Raid.png
26 2023.11.14 blurb
Artist's conception of Sedna.jpg
27 2023.12.01 blurb
Florence Petty (1870-1948; aka The Pudding Lady).jpg
28 2023.12.06 blurb
'The Good Place' cast and crew visit San Diego Comic Con for a panel cropped.jpg
notice that the edit to {{main page image/TFA}} in question was made on 2022.05.27, and that a review of the archived versions of wikipedia's main page on web.archive.org shows that the last of the above images that ran on the main page before the edit was resized correctly at 118 px × 167 px, while the first after the edit was resized incorrectly at 140 px × 190 px.
i believe, to fix the issue, one can either both revert this edit to {{main page image/TFA}} and this edit to {{remove file prefix}}, or alternatively, implement in {{main page image/TFA}} the code that was present in this version of {{remove file prefix}}. (in the first case, i assume the recent updates to the documentation of {{remove file prefix}} should also be reverted.) of course, there may be other solutions; these are just the two that seem the most clear to me. dying (talk) 19:59, 1 March 2024 (UTC)[reply]
I think you are mistaken. Those changes could not have any effect on the size of the images. At first you were talking about issues with punctuation marks and now you are talking about image widths. I don't think there is any problem with this template — Martin (MSGJ · talk) 21:14, 1 March 2024 (UTC)[reply]
Martin, i haven't switched topics. both of my comments above discussed how certain punctuation marks in the filename of an image currently prevent the "main page image" module from correctly determining the proper width of an image to be resized. i believe this is because the current implementation of {{main page image/TFA}} uses the "PAGENAME" magic word, which does not preserve some of these punctuation marks. perhaps the following six examples will help shed some light on the issue. note that the code used in the second and fourth examples is based on the implementation of the {{remove file prefix}} template before it was reimplemented with the "PAGENAME" magic word.
code output
{{PAGENAME:file:Artist's conception of Sedna.jpg}} Artist's conception of Sedna.jpg
{{#invoke:string|replace|{{#invoke:string|replace|file:Artist's conception of Sedna.jpg|^%s*[Ff][Ii][Ll][Ee]%s*:%s*||plain=false}}|^%s*[Ii][Mm][Aa][Gg][Ee]%s*:%s*||plain=false}} Artist's conception of Sedna.jpg
{{#invoke:main_page_image|width|{{PAGENAME:file:Artist's conception of Sedna.jpg}}}} 140
{{#invoke:main_page_image|width|{{#invoke:string|replace|{{#invoke:string|replace|file:Artist's conception of Sedna.jpg|^%s*[Ff][Ii][Ll][Ee]%s*:%s*||plain=false}}|^%s*[Ii][Mm][Aa][Gg][Ee]%s*:%s*||plain=false}}}} 162
{{#invoke:main_page_image|width|Artist's conception of Sedna.jpg}} 162
{{PAGENAME:!!@$%^&*()!'";:=+!}} !!@$%^&*()!'";:=+!
i am assuming that you currently believe that "PAGENAME" preserves the four aforementioned characters if they appear in an image's filename. the first of the six examples above appears to confirm this at first glance, but if you actually look at the html code for that first example, you should be able to see that "PAGENAME" did not preserve the apostrophe. (admittedly, i am not positive that you will be able to see the issue in the html code, as this may be dependent on your browser and the namespace in which the code appears. if you are unable to see the issue, a longer explanation is provided below.) interestingly, the last example shows that, in addition to the four aforementioned characters, "PAGENAME" apparently also does not preserve (1) the exclamation point ('!') if it is the first character of the filename, and (2) the equals sign ('=').
extended explanation
i noticed that the output of "PAGENAME" can generally be accurately observed when the code is in either the main, user, file, or template namespace, but may not be so if the code is in any of their associated talk namespaces, or in either the wikipedia or wikipedia talk namespace. as a result, previewing the above table of examples on a page in user space may work for you.
alternatively, using the "string" module to determine every character in the output appears to avoid this dependency, though there may be an issue with displaying the character in question when it is either an octothorpe ('#'), a semicolon (';'), an asterisk ('*'), or a colon (':'). (i assume this is because those characters are often used to mark up lists.)
the table of examples below attempts to more clearly show the contents of the output of "PAGENAME" in the earlier examples, but may have issues displaying those four aforementioned characters associated with marking up lists, as illustrated in the first six examples below. to make the table more easy to understand, i have also included a column showing what the actual character in each example is, in case the entry in the "output" column is not displaying properly.
code output actual
{{#invoke:string|pos|1#;*:6|1}} 1 1
{{#invoke:string|pos|1#;*:6|2}}
#
{{#invoke:string|pos|1#;*:6|3}}
;
{{#invoke:string|pos|1#;*:6|4}}
*
{{#invoke:string|pos|1#;*:6|5}}
:
{{#invoke:string|pos|1#;*:6|6}} 6 6
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|1}} A A
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|2}} r r
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|3}} t t
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|4}} i i
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|5}} s s
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|6}} t t
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|7}} & &
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|8}}
#
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|9}} 3 3
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|10}} 9 9
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|11}}
;
{{#invoke:string|pos|{{PAGENAME:file:Artist's conception of Sedna.jpg}}|12}} s s
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|1}} & &
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|2}}
#
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|3}} 3 3
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|4}} 3 3
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|5}}
;
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|6}} ! !
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|7}} @ @
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|8}} $ $
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|9}} % %
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|10}} ^ ^
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|11}} & &
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|12}}
#
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|13}} 3 3
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|14}} 8 8
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|15}}
;
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|16}}
*
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|17}} ( (
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|18}} ) )
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|19}} ! !
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|20}} & &
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|21}}
#
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|22}} 3 3
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|23}} 9 9
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|24}}
;
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|25}} & &
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|26}}
#
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|27}} 3 3
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|28}} 4 4
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|29}}
;
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|30}} & &
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|31}}
#
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|32}} 5 5
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|33}} 9 9
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|34}}
;
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|35}}
:
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|36}} & &
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|37}}
#
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|38}} 6 6
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|39}} 1 1
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|40}}
;
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|41}} + +
{{#invoke:string|pos|{{PAGENAME:!!@$%^&*()!'";:=+!}}|42}} ! !
to see how {{main page image/TFA}} fares with images that have either an exclamation point or an equals sign in their filenames, i found three additional images to test, as seen in the table below. as before, all the images in this table are presented with the {{main page image/TFA}} template.
image filename
!-2011-debowa-leka-kosciol-abri.jpg
Church of Saint-Louis-du-Ha!-Ha! - 52048198523.jpg
[[File:|140px| ]]
Just For The Record =.png
as expected, the image with a filename that begins with an exclamation point is currently not properly resized by {{main page image/TFA}}, and the width of its thumbnail was set to the default value of 140 pixels, even though it should have been set to 171 pixels. the thumbnail of the image with exclamation points in the middle of its filename was correctly resized, as was also expected, since "PAGENAME" preserves exclamation points in a filename that are not the first character of the filename.
Just For The Record =.png
surprisingly, although i was expecting the thumbnail for the image with an equals sign in its filename to end up with a width of 140 pixels, the {{main page image/TFA}} template won't even return a thumbnail for the image. to be clear, the file "Just For The Record =.png" does exist and can be displayed correctly on wikipedia, as seen at right. however, there appears to be a bug in the {{main page image/TFA}} template (possibly unrelated to the "PAGENAME" issue) that prevents an image from displaying correctly when using the template if the image has an equals sign in its filename. in any case, the string "[[File:|140px| ]]" that is being displayed in place of the thumbnail shows that the thumbnail would likely have also had a width of 140 pixels had the code been able to generate one.
does the above explanation make things more clear? if not, please let me know which parts do not make sense, and i will try to elucidate. of course, it is also possible that i am mistaken, but in that case, there is still clearly a bug with the code for the main page, which i have so far been unable to find. would you be able to help me find it?
by the way, xaosflux, regarding this discussion, i now realize that the reason why the original problematic image in this tfa blurb was so tall (as seen captured here and archived here) was because it was not being resized properly. instead of being resized to a more reasonable 102 px × 193 px, the code defaulted to a width of 140 pixels because there was an apostrophe in the image's filename, as explained above, making the image 140 px × 265 px. i should have figured it out back then, but it hadn't occurred to me at the time that there may have been a bug in the code for the main page.
the image currently in dyk's queue 1, presented using {{main page image/DYK}}
the image currently in dyk's queue 1, presented using {{main page image/DYK}}
courtesy pinging theleekycauldron and DatGuy, who both discussed the last change to the "main page image" module and presumably have a better understanding of the module than i do. theleekycauldron, note that the image in dyk's queue 1 [perm], which is scheduled to run the day after tomorrow, is currently affected by this bug because its filename, "Joseph Karl Stieler's Beethoven mit dem Manuskript der Missa solemnis.jpg", contains an apostrophe. if we are unable to find and fix this bug by the end of tomorrow, i would recommend manually setting the width of that image to 125 pixels. dying (talk) 21:59, 2 March 2024 (UTC)[reply]