Difference between revisions of "Template:FileCaption/doc"

From WikiCorporates
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
−
Experimenting with a template found on [https://www.mediawiki.org/wiki/Template:Image MediaWiki].<br/>
+
Template which uses MediaWiki's "File:" syntax for images with captions and borders, as an alternative to the not-very-pretty ones that come built-in. Very similar to [[Template:img]], but only uses uploaded files.<br/>
−
Used to provide images with captions as an alternative to the ugly ones with a frame that come with MediaWiki.
+
MediaWiki did something similar in 2014, but ditched it due to problems with videos. See [https://www.mediawiki.org/wiki/Thumbnail_style_update Thumbnail style update].
  
−
ToDo: Rename to "File Title" to imply this template is used with "File:..." syntax.
+
Found [https://www.mediawiki.org/wiki/Template:Image a template], which looks very similar to MediaWiki's [https://www.mediawiki.org/wiki/Template:Image_frame own version].
  
 
=== Usage ===
 
=== Usage ===
−
* <code>file=</code> Sets which file to use. Default value is 1AKC Samoyed Dog Show 2011.jpg.
+
<div>The first 3 parameters are mandatory; all others are optional.</div>
−
* <code>width=</code> width of the image.
 
−
* <code>height=</code> height of the image
 
−
* <code>align=</code> Sets alignment of image and caption block. Options are right, left, center, and none. Default is right.
 
−
* <code>caption=</code> Places a caption beneath the image, and also serves as the alt text. Optional.
 
−
* <code>padding=</code> Gives the option to turn off padding, in case the image is part of a floating div already. Default is to include padding; turn off by setting parameter to "no".
 
 
<pre>
 
<pre>
−
{{Img Title
+
{{FileCaption
−
|file - the filename of the image
+
|img-name - filename of the image
−
|50              - width
+
|000      - width
−
|50              - height
+
|000      - height
 +
|float=    - [none|left|right]. Default is float=right; margin-left=0.5em.
 +
                                If float=right, then ml=0.5em.
 +
|ml        - margin-left. No default.
 +
|mr        - margin-right. No default.
 +
|border    - border colour. See ColorBoxes below for some choices.
 +
|caption  - caption
 +
|pad      - padding between image and border; 0.2em is ok.
 
}}
 
}}
 
</pre>
 
</pre>
 +
{{ColorBox|#808080|Dark: #808080}} {{ColorBox|#a0a0a0|Medium: #a0a0a0}} {{ColorBox|#bebebe|Light: #bebebe}}
  
 
=== Example ===
 
=== Example ===
−
<pre>{{Img Title|Influencers.svg|50|50}}</pre>
+
<pre>{{FileCaption|Nuclear-Waste-Low-Level-Site.png|200|137|float=right|border=#a0a0a0|caption=[http://news.bbc.co.uk/ BBC Guide] to UK Nuclear Power{{plink|http://news.bbc.co.uk/}}</pre>
−
Gives the image at the top right of this page.
+
Gives:
−
{{Img Title|file=Influencers.svg|width=50|height=50}}
+
{{FileCaption|Nuclear-Waste-Low-Level-Site.png|200|137|float=right|border=#a0a0a0|pad=0.2|caption=[http://news.bbc.co.uk/2/shared/spl/hi/guides/456900/456932/html/nn3page1.stm BBC Guide] to UK Nuclear Power}}  
  
−
 
+
<includeonly>[[Category:WikiCorporates templates]]</includeonly>
−
<includeonly>[[Category:WikiPolitiks templates]]</includeonly>
 

Latest revision as of 14:02, 30 May 2020

Template which uses MediaWiki's "File:" syntax for images with captions and borders, as an alternative to the not-very-pretty ones that come built-in. Very similar to Template:img, but only uses uploaded files.
MediaWiki did something similar in 2014, but ditched it due to problems with videos. See Thumbnail style update.

Found a template, which looks very similar to MediaWiki's own version.

Usage

The first 3 parameters are mandatory; all others are optional.
{{FileCaption
|img-name  - filename of the image
|000       - width
|000       - height
|float=    - [none|left|right]. Default is float=right; margin-left=0.5em.
                                If float=right, then ml=0.5em.
|ml        - margin-left. No default.
|mr        - margin-right. No default.
|border    - border colour. See ColorBoxes below for some choices.
|caption   - caption
|pad       - padding between image and border; 0.2em is ok.
}}

 Dark: #808080   Medium: #a0a0a0   Light: #bebebe 

Example

{{FileCaption|Nuclear-Waste-Low-Level-Site.png|200|137|float=right|border=#a0a0a0|caption=[http://news.bbc.co.uk/ BBC Guide] to UK Nuclear Power{{plink|http://news.bbc.co.uk/}}

Gives:

Nuclear-Waste-Low-Level-Site.pngBBC Guide to UK Nuclear Power