Jump to content

Template talk:Image

Add topic
From Wikispecies
Latest comment: 6 months ago by Tungolen in topic Legends


Legends

[edit]

Can this template be made to pull in legends, for example like the one on d:Q4043977? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 12:14, 8 February 2017 (UTC)Reply

I made a version that uses the depicts qualifier, which is currently on {{Image/sandbox}}. See also discussion at User_talk:Tungolen#Image_template Tungolen (talk) 00:24, 28 July 2025 (UTC)Reply
I moved this version from the sandbox to the main template. I think it's good, but one issue I've noticed is that it's pulling in the vernacular label on Dasycrotapha. I haven't figured out yet how to make it either not do that or at least respect user language settings when doing so. I'll need to dig in for a while to get the solution. I'm not sure Module:wd as it currently exists supports it? It defaults the language of the site's language code ($wgLanguageCode) which makes sense for most wikipedias but not here. I'll work on the problem though. Tungolen (talk) 10:27, 30 July 2025 (UTC)Reply
I've made an improved prototype of {{Image}} as well, though I never ended up merging it. See this and the prototype at User:WrenFalcon/Image. (Feel free to use any code from User:WrenFalcon/Image or on a subpage of that, just credit me in the edit summary if you do!)
  • "one issue I've noticed is that it's pulling in the vernacular label on Dasycrotapha"
I fixed that particular problem with first fetching the Wikidata ID, then passing that to another WD call to fetch the taxon name property. One other possible issue is that if someone views a page in a non-English language, where the label in that language on the Wikidata item for the taxon rank is not "species", "subspecies", etc., the template may incorrectly assume that it's not at the species level or lower. I think my prototype addresses that too, by comparing the Wikidata ID of the taxon rank against a list of subspecific ranks plus the species rank. --WrenFalcon (talk) 00:28, 31 July 2025 (UTC)Reply
Nice! Thanks for letting me know. Tungolen (talk) 01:01, 31 July 2025 (UTC)Reply

Another bug for me to fix: Ostracoda has an image on our side with no caption, but it's picking up a "depicts" tag from wikidata anyway. That's unfortunate. This is actually two bugs in one, because it's picking up "depicts" data from the second of two images on wikidata, so I think it'd still be wrong even if we didn't specify an image on our end. I'm investigating a solution. In the meantime, I'm waffling on whether this is bad enough to merit rolling back the template to the version that doesn't check "depicts". If someone wants to do that, there'd be no objection from me. (Edit: I went ahead and did that while I work on the sandbox version) Tungolen (talk) 22:01, 30 July 2025 (UTC)Reply

Full list of issues with the new version that I know about, roughly in order of how bad I think they are. Will update as needed:

  • does not guarantee the correct label when more than one image is available on wikidata
  • pulls in a caption even if image is set on our side (e.g. Ostracoda)
  • use of vernacular (english) labels (e.g. on Dasycrotapha)
  • Does not ensure correct (lack of) italicization at higher ranks
  • Difficult situation when the wikidata image lacks clear species identification, e.g. Gynoxys. I've manually inserted a caption of Gynoxys sp. but maybe it would be nice to get that automatically?
  • The maintenance category shows up even if we're manually specifying an image and not relying on the one from wikidata.
  • The list of taxon ranks to *not* flag a missing "depicts" caption from wikidata is incomplete. I believe we want to exempt taxa at species and below. Currently I have species, subspecies, and nothospecies, I just noticed variety should be there, and I'm sure there's a bunch of others.

Tungolen (talk) 22:22, 30 July 2025 (UTC)Reply

Thank you for your work on this.
If the page & Wikidata item are about a species, but the image depicts a subspecies, wouldn't we want the caption to say so? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 10:38, 31 July 2025 (UTC)Reply
Certainly, yes. A more specific "depicts" from wikidata will still be used if it's present, but the goal is just that species pages without a "depicts" qualifier won't end up in the maintenance category. That's the exemption I'm talking about. I misspoke in the original version of this list if you saw that version. Tungolen (talk) 12:28, 31 July 2025 (UTC)Reply
For e.g. Ostracod.JPG on Template:Image/testcases, the name "Ostracoda" is currently being put through {{taxit}}, italicizing it as though it is a genus name. However, this name should not be italicized. It is possible to use the corresponding Wikidata item to detect the rank of the taxon and only put the name through {{taxit}} if it is at the rank of genus or below. My prototype does this; see User:WrenFalcon/Image/wd taxit. However, I believe it may still be missing a few ranks, e.g. nothospecies, but that's a simple fix. --WrenFalcon (talk) 17:59, 31 July 2025 (UTC)Reply
Thanks. I've been reading up on the codes but I've only read all the way through the ICNP right now, which I think is a lot looser than the others on that point - they recommend italicizing names at all ranks but consider it basically optional either way. I did read though all your templates already, and I think they're quite good, I'm just working my way around to that a little bit at a time to make sure I understand all the fine details. A good one for the list though. Tungolen (talk) 22:56, 31 July 2025 (UTC)Reply
Understood. If you have any questions, I'm happy to help or to explain my templates!--WrenFalcon (talk) 02:19, 1 August 2025 (UTC)Reply
Are you sure it's necessary to use the bare QIDs for comparison as in [your edit here]? As far as I can see, the label retrieved is dependent on the language settings of the wiki, not the user's language preferences, which means it should be stable. Language independence is nice, but it's a lot more readable to just use the label. Tungolen (talk) 09:17, 3 August 2025 (UTC)Reply
You might be right on that point—I had assumed that it would fetch the label in the user's language. Personally, I might prefer to use the QID, but that's from my perspective as a programmer. I believe there's also a way to specify the language the label will be fetched in using {{Wikidata}}. --WrenFalcon (talk) 13:54, 3 August 2025 (UTC)Reply
I looked for that earlier but couldn't find it. Default behavior is to pull the label of the Wiki's language, and the optional flag is add fallback behavior to any available language label if the wiki language isn't available, but that's it.
At any rate, I just updated the sandbox with my new version. The relevant links:
They're structured so that each call to wikidata only gets made once and then is passed to the next subtemplate which can use the result multiple times. I also pulled over a couple useful templates from wikipedia: Template:Ifnumber, Template:Testcases other, Template:Is italic taxon, and Template:Link if exists. I took from your templates where appropriate. I think it's pretty good so far. Tungolen (talk) 00:42, 4 August 2025 (UTC)Reply
Issue: {{Image/caption}} may link to the incorrect taxon page, or not link to the taxon page when it does exist, in certain situations. Requirements: The depicted taxon (either set explicitly in Wikidata or implied by a lack of the depicts property) must have a taxon name (P225) that is different than the page name of the Wikispecies entry corresponding to that taxon. Example: Place {{Image/sandbox}} on Tipula (Tipula); the caption links to Tipula (incorrect). I believe this would also happen in situations where the depicted taxon is one with a page like Microdon (Animalia).
To fix this, rather than using {{Link if exists}}, one solution is to use {{#if:{{Wikidata|title|{{{from}}}}}|[[{{Wikidata|title|{{{from}}}}}{{!}}...]]}} or similar (as seen in User:WrenFalcon/Image/link taxon). --WrenFalcon (talk) 01:00, 6 August 2025 (UTC)Reply
Good catch. That needs to be handled for the italicized branch as well, I believe. Link if exists is fine as long as we don't mind the wikispecies page title being the caption instead of the bare taxon name, but if we want to use the taxon name as the caption while linking to the correct (differently named) wikispecies page a little more is needed. Looking into the ideal solution. Tungolen (talk) 03:06, 6 August 2025 (UTC)Reply
I updated {{Image/caption with category}} to query wikidata before calling {{Image/caption}}. {{Image/caption}} now get passed the sitelink, taxon name, and whether to italicize, then determines what combination of arguments we've received and calls a helper template {{Image/caption link}}. This version should account for the full matrix of every combination of italicness, sitelink, and taxon name. I added both Tipula (Tipula) and Microdon (Animalia) to the testcases page. Tungolen (talk) 04:03, 6 August 2025 (UTC)Reply

Italics off for some captions

[edit]

I propose we add a new parameter with the purpose of not automatically adding italics to the captions. This would shorten the code necessary for all captions that doesn't exactly match the taxon name of a genus and/or species, e.g. author names, names of familiæ and higher taxa, images that visualise age- or gender differences between specimens of the same species, data about distribution, perhaps pictures of eggs, etc.

I propose that the parameter is named italics and/or simply i, and that the attributes no and - (i.e. "minus") are used to not automatically add italics to the caption. All other values, including leaving the parameter blank, would render the default behaviour i.e. add italics just like today.

Examples for say, the Numenius arquata and Carolus Linnaeus the Younger pages:

Code string Rendered text today Rendered text after template update
{{Image}} Numenius arquata Numenius arquata
{{Image|Forslund, Linnaeus filius.jpg}} Carolus Linnaeus the Younger Carolus Linnaeus the Younger
{{Image|Forslund, Linnaeus filius.jpg|Carolus Linnaeus the Younger}} Carolus Linnaeus the Younger Carolus Linnaeus the Younger
{{Image|Forslund, Linnaeus filius.jpg|i=no}} i=no Carolus Linnaeus the Younger

After such an addition to the template, would it be possible to use a bot in order to accommodate the changes for the approximately 74, 600 pages where the {{Image}} template is currently used? –Tommy Kronkvist (talk)‚ 12:46, 28 September 2019 (UTC).Reply

Template Images, format on author pages

[edit]

Moved: was at [[Talk:User_talk:Estopedist1#Template_Images,_format_on_author_pages]]
Hello Estopedist1, thanks for all your contributions. On author pages, if you use a mere {{Image}}, the description of the image will be in italics, which is not wanted here. See my edit on Thomas Meehan for a possible solution. Maybe the template could be amended with a parameter for correct formatting of author pages? Kind regards, --Thiotrix (talk) 08:28, 25 August 2020 (UTC)Reply

@Thiotrix: nice catch! I understand, it disturbs. In part, related to Wikispecies:Village_Pump#"Displaytitle". Image fetching from Wikidata and captioning definitely have to be automated process (at least for taxon authorities), but removing italic-command from {{Image}} affects taxon articles as well. Maybe user:Pigsonthewing or user:Monster Iestyn have ideas?--Estopedist1 (talk) 08:49, 25 August 2020 (UTC)Reply
It would be better if you could directly control whether italics are used or not, rather than have to explicitly put in both the file name and description as a workaround. That the template automatically adds italics by default if you had neither always did bother me. Monster Iestyn (talk) 08:56, 25 August 2020 (UTC)Reply
@Thiotrix: If there is a problem with the template, please raise it on the template's talk page. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 10:12, 25 August 2020 (UTC) Moved, so struck. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 09:57, 27 August 2020 (UTC)Reply

the question is easy: do we want that by default image's caption is in italic or not Italic. I prefer not Italic, because then we save a lot of time and Wikidata does the job. If we prefer status quo, then everything should be done manually, except in species and genus articles and ONLY THEN, if we use {{image}} and ONLY THEN when article's name is without brackets (eg invalid rendering here: Axia (Cimeliidae)). Also notice that the whole system may be changed, when we will have possibility to get image's caption directly from Wikidata--Estopedist1 (talk) 12:49, 25 August 2020 (UTC)Reply

We have far more taxons than people, and far more taxons at lower ranks than higher. For both of these reasons the default should be to italicise. Even when we can fetch image labels from Wikidata, there will be cases where no label is set there, so we need to default to the page name. It is a pity that we do not have our people pages in a namespace such as "Author:" (as used on Wikisource), which would allow us to set the italicisation by using namespace-detection. What is needed in this case is a parameter to reverse the default, such as |italics=no; There should be no need to manually enter the entire caption to do this. This is what Tommy proposed, above. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 09:52, 27 August 2020 (UTC)Reply
I support Tommy's proposal then, I think we should definitely get that implemented asap. Monster Iestyn (talk) 10:35, 27 August 2020 (UTC)Reply
@Pigsonthewing and Monster Iestyn: no hurry here, please! Italic in authority articles is not an obvious error. I think that adding parameter |italics=no may be a mistake and just additional manual work. Usually, our images in taxon articles need some kind of explanation and blatant {{image}} is not a good solution. Almost always it is valid in genus articles, where a image needs species link. And please don't underestimate possibilities when fetching images' titles from Wikidata become reality--Estopedist1 (talk) 11:05, 27 August 2020 (UTC)Reply
"Usually, our images in taxon articles need some kind of explanation" I doubt this true; do you have any evidence to support it? And where do you think either of us "underestimates possibilities when fetching images' titles from Wikidata"? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 18:27, 27 August 2020 (UTC)Reply
it seems that this topic needs more input by other WS users to move on. But status quo situation does minimal harm. Somewhat similar is situation with Wikispecies:Village_Pump#"Displaytitle"--Estopedist1 (talk) 19:43, 28 August 2020 (UTC)Reply
No, it does a non-trivial amount of harm: we have people removing the template from Author pages due to the italics. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 12:12, 29 August 2020 (UTC)Reply
if you are right, then the question is acute, indeed. Could we temporarily remove these Italic tags from this template? At least the deletionist can't then delete images from authority articles. If image's caption is not in Italic in some species articles, it is may be not so harmful--Estopedist1 (talk) 18:02, 29 August 2020 (UTC)Reply
As I said above, "We have far more taxons than people, and far more taxons at lower ranks than higher. For both of these reasons the default should be to italicise.". Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 18:32, 29 August 2020 (UTC)Reply
Re "Usually, our images in taxon articles need some kind of explanation" ... I doubt this true - it is true; in general, an image is best if it names both the taxon and the location where the image was taken for very important context (see the quote at the top of my user page!). And that has to be added with the taxon name in italics, and the location in normal type. PS to @Pigsonthewing: - one taxon, two taxa; "taxons" looks plain ugly ;-) MPF (talk) 21:04, 29 August 2020 (UTC)Reply
Note the key qualifier usually, which your comment does not address. What proportion of our images have captions in the manner that you suggest? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 21:54, 29 August 2020 (UTC)Reply
I've no idea what the proportion is overall; it applies to virtually all images on pages I've edited, and if we are to maintain scientific veracity, it should apply to all photo captions - MPF (talk) 22:44, 29 August 2020 (UTC)Reply

──────────────────────────── I am totally fed up coming across the use of a bare {{Image}} on genus taxon pages leading to unlabelled species images, it should be reversed as it causes unwanted work. Andyboorman (talk) 17:50, 31 August 2020 (UTC)Reply

Here is an attempt to not display the {{PAGENAME}} in italics if the template is used on author pages. Korg (talk) 14:19, 15 October 2020 (UTC)Reply
@Korg: nice playing with these bracket stuff. At the moment, your solution is working, see eg Louis Pasteur. Thanks, Korg!--Estopedist1 (talk) 11:55, 16 October 2020 (UTC)Reply
It's a pleasure! It is an iterim solution and the template could be improved with the help of a Lua module to address special or more complex cases, like the ones raised above. Korg (talk) 13:46, 16 October 2020 (UTC)Reply
@Korg: Apologies for pinging you here a few years later, but it appears your solution unfortunately isn't working anymore. Image descriptions now display the page name in italics on author pages once more! (I don't know when this broke unfortunately, I just realised this is happening now.) Monster Iestyn (talk) 22:22, 17 April 2024 (UTC)Reply
@Monster Iestyn: Thanks for letting me know!
When the solution worked, calling the {{#statements:P31}} function returned the following code: <span><span>human</span></span>. Now, for some reason, it returns an additional link: <span><span><a href="/wiki/Homo_sapiens" title="Homo sapiens">human</a></span></span>.
I've changed the way to call the unlinked value ("human") by using #property instead of #statements, as described in d:Wikidata:How to use data on Wikimedia projects#Raw value. Korg (talk) 22:03, 4 September 2024 (UTC)Reply
Thank you. It works well now. –Tommy Kronkvist (talk), 10:16, 5 September 2024 (UTC).Reply

Sex annotations from Wikidata/structured data?

[edit]

When using a bare {{Image}}, would it be possible to fetch the value of the property sex or gender (P21) either from the structured data on the Commons item (as a qualifier under "depicts", e.g. File:Phormia regina male from front.jpg), or perhaps as a qualifier under the property image (P18) on the Wikidata item for the associated taxon? If the value is male organism (Q44148), it would format the name as ''{{BASEPAGENAME}}'' (♂), and if it's female organism (Q43445), it would format the name as ''{{BASEPAGENAME}}'' (♀). This could simplify pages like Eristalis hirta, for example. --WrenFalcon (talk) 17:53, 28 February 2025 (UTC)Reply