Benutzer:Ahnenfan/Test ImageCaptionFromDescriptionPage

Aus Westmärker Wiki
Zur Navigation springen Zur Suche springen

Kann ich ein Bild einfügen und sei ne Beschreibung aus der Dateiseite entnehmen?

Benötigt: in HIS, aber auch hier

I want to display an image on our MediaWiki site using the description from its file description page as the caption in the syntax [[File:imagename.png|frame|caption]]. To clarify, I'm not trying to link to the image's description page.

I've read some things about querying the API on this question but I'm struggling to see how I can display the result of the query on the property (be it iiprop=comment or rvprop=content or...something else) in the source itself.

edited May 23, 2017 at 10:27

If this is a locally uploaded file, and your description pages don't have extraneous formatting, you could get away with something like this:

[[File:imagename.png|frame|{{File:imagename.png}}]]

But there's plenty of ways that can go wrong...

answered Oct 2, 2013 at 0:12

And of the description pages contain more than the text to include, you could use something like , right?

– svick Oct 2, 2013 at 8:06

@Brion: This works very nicely; thank you. Could you give me an example of what kind of formatting that might cause a problem? I added a span and some bold markup to my description to test the solution and had no problems.

– skia.heliou Oct 2, 2013 at 14:00

@skia.heliou, it's called transclusion. Any MediaWiki page can be used as a template. The simplest way that can go wrong is the presence of a ]] or | which gets added in the markup of your image, breaking it.

– Nemo May 3, 2015 at 6:07

Quelle: https://stackoverflow.com/questions/19120518/how-do-i-display-a-mediawiki-images-file-description-as-its-caption

Ja!

Datei hochgeladen mit MsUpload