The generic "fetch property values" that I wrote is capable of replacing #property in a more intelligent manner - documented at:

For simple cases though, #property will work - for example if you paste the following into any section of an article and *preview* it, it will return the image from Wikidata:

{{#if: {{#property:p18}} | [[File:{{#property:p18}}|thumb]] |}}

Similarly, in an infobox, just using |image = {{#property:p18}} will work fine.

However, Wikidata can store multiple image filenames, so the question is: how do you want to deal with those cases?

Building a Lua call to return an image or something like Noimage.svg is a trivial job : I've made a demo module at:

If you paste {{#invoke:Sandbox/RexxS/Images|getImage}} into and preview it you'll see "Kafka portrait.jpg"

If you paste {{#invoke:Sandbox/RexxS/Images|getImage}} into and preview it you'll see "Noimage.svg"

Obviously calls can be buried inside templates to hide them from editors - either an infobox or create a template to make the image as a thumb outside of an infobox, etc.


On 3 September 2014 12:42, Andy Mabbett <> wrote:
On 3 September 2014 04:51, Jane Darnell <> wrote:
> I would like the same sort of thing for use on the English Wikipedia for
> pictures, so for example if you link to the Wikidata item image property and
> this is filled with a value, it will present the image that is on Wikidata,
> and if not, will present an alternate such as [1]. Has anyone built such a
> thing?
> [1]

No, but people have written templates that pull in other Wikidata
values, so it's certainly possible.

I'm blind-copying this to someone who may be able to help.

Andy Mabbett