Automatic image attribution from Commons

Trying out how it looks embedded. No automatic copyright info? Should we have an add-on for using Commons images? Would be nice to just call on the image and have everything else solved. Until then: Patricia Costillo [CC BY-SA 4.0 (]


Wikimania 2019 Group Photo Black and White version

@Ainali, if you use the HTML code as in the above, the image credit shows up when you hover over the image. We will likely want a different long term solution that more clearly showcases the credit, but this does work.

1 Like

Attribution: Wikimedia Commons, Patricia Costillo, CC BY-SA 4.0 ;)

@ELappen_WMF Sorry, I saw your message later than I sent mine. You are right, it appears with hovering.

1 Like

Doesn’t hurt to have two attributions! :)

@ELappen_WMF The appearance of the two group photos are different: the first one does not provide proper attribution, while yours does with hovering. I believe, Ainali inserted the picture by downloading and uploading it, while you chose the direct linking option. Is this correct?

I did the direct link with the HTML code specifically. If you use the file URL link it also doesn’t display the attribution.

1 Like

Hovering works probably alone on desktop with mouse, and not with touchscreen devices like tablets.


That basically just means having a custom onebox plugin for Commons image links (raw and filepage), right? Which should be fairly easy.


@Tgr_WMF1 if this was a feature request already, than it would be nice, if it worked with the link to the description page (like facebook does). :slight_smile:

If I insert a photo with this kind of link, this is the result:

@ELappen_WMF just for learning: how the HTML code looks like to display the attribution by hovering?

No, I used Add an image > From the web and dropped the commons URL for the 1024px image. And if discourse then automatically fixed the credits I would be happy. No downloading and uploading, and only copying one line from Commons to insert an image.

@Ainali I realized meanwhile, see Elena’s answer and my test above. Thanks for the clarification.

Just to clarify: exactly which HTML code did you use to get that result?

Hey @Ainali, using this code yields those results:

<a title="Patricia Costillo [CC BY-SA 4.0 (], via Wikimedia Commons" href=""><img width="512" alt="Wikimania 2019 Group Photo Black and White version" src=""></a>

Accessible via: Commons Page URL > Use this file on the web > HTML code


Public Domain, Leonardo da Vinci

Note that this code does not seem to appear on mobile, so if you’re embedding an image from Commons on mobile, you’d have to use the file URL and do the image attribution below.

Automatic image attribution is an important feature that we will be commissioning. I’ve just created a task and committed it for next quarter: T236093. Assuming nothing tremendously urgent comes up between now and then, we should be able to get to work on this soon.



Now, what if (and I am not saying this should be turned on everywhere by default) Mediawiki itself had the possibility to generate automatic file attribution? If it could be built for Discourse, surely it could be built for Mediawiki too? I am aware that I am totally deviating from this issue, but to me it would be a much worthier cause.

MediaViewer does generate attribution, FWIW.

1 Like

That is true, but that is one click away (as is regular Mediawiki).

The Timeless skin is missing the “Use this file” link…
For those using Timeless: add &useskin=vector to the URL, or use the media viewer.