Difference between revisions of "Template:FileCaption/doc"

From WikiCorporates
Jump to navigation Jump to search
m (→‎ToDo)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
−
<small>[[Template:Img Title|Template]]</small> Experimenting with an image at the top right of the page, on the same line as the Page Title.
+
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/>
 +
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].
  
−
How big the image can be is determined by (a) <nowiki><h1></nowiki> lineheight (1.3) and (b) <nowiki><h1></nowiki> top margin (0). An image taller than 50px is obscured by the Search box.
+
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].
−
<pre>
 
−
Path is set to http://wikipolitiks.local/Images/
 
−
</pre>
 
  
 
=== Usage ===
 
=== Usage ===
 +
<div>The first 3 parameters are mandatory; all others are optional.</div>
 
<pre>
 
<pre>
−
{{Img Title
+
{{FileCaption
−
|image-name.png - 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|Influencers.svg|50|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}}
−
 
 
−
=== ToDo ===
 
−
This template only works for external images, ie. not stored in the database. It doesn't seem possible to have an internal link - I want to link to the top-level Category, eg. "Category:Influencers". See [https://www.mediawiki.org/wiki/Help:Images Mediawiki Help:Images]<br/>
 
−
For internal images, I will have to do the following. The downside is that the height is hard-wired into the .css:
 
−
<pre>
 
−
Put a style in MediaWiki:Common.css
 
−
  .img-title { position:absolute; top:-50px; right:0; }  (''done'')
 
−
Then:
 
−
  [[File:Foreign-Policy-Centre.png|182x50px|class=img-title|link=Category:Influencers]]
 
−
</pre>
 
  
−
<includeonly>[[Category:WikiPolitiks templates]]</includeonly>
+
<includeonly>[[Category:WikiCorporates 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