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

https://en.wikipedia.org/wiki/Module:Wikidata

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:

https://en.wikipedia.org/wiki/Module:Sandbox/RexxS/Images

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

If you paste {{#invoke:Sandbox/RexxS/Images|getImage}} into
https://en.wikipedia.org/wiki/Hangthwaite 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.

-- 
Rexx



On 3 September 2014 12:42, Andy Mabbett <a...@pigsonthewing.org.uk> wrote:

> On 3 September 2014 04:51, Jane Darnell <jane...@gmail.com> 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] https://commons.wikimedia.org/wiki/File:Noimage.svg
>
> 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
> @pigsonthewing
> http://pigsonthewing.org.uk
>
_______________________________________________
Wikidata-l mailing list
Wikidata-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-l

Reply via email to