Difference between revisions of "Template:FileCaption/doc"

From WikiCorporates
Jump to navigation Jump to search
m
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.
+
Experimenting with a template found on [https://www.mediawiki.org/wiki/Template:Image MediaWiki].<br/>
 +
Used to provide images with captions as an alternative to the ugly ones with a frame that come with MediaWiki.
  
−
ToDo: Rename this to "Img Titlebar" or some such.
+
ToDo: Rename to "File Title" to imply this template is used with "File:..." syntax.
−
 
 
−
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.
 
−
<pre>
 
−
Path is set to http://wikipolitiks.local/Images/
 
−
</pre>
 
  
 
=== Usage ===
 
=== Usage ===
 +
* <code>file=</code> Sets which file to use. Default value is 1AKC Samoyed Dog Show 2011.jpg.
 +
* <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
 
{{Img Title
−
|image-name.png - the filename of the image
+
|file - the filename of the image
 
|50              - width
 
|50              - width
 
|50              - height
 
|50              - height
Line 20: Line 22:
 
<pre>{{Img Title|Influencers.svg|50|50}}</pre>
 
<pre>{{Img Title|Influencers.svg|50|50}}</pre>
 
Gives the image at the top right of this page.
 
Gives the image at the top right of this page.
−
{{Img Title|Influencers.svg|50|50}}
+
{{Img Title|file=Influencers.svg|width=50|height=50}}
  
−
=== 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:WikiPolitiks templates]]</includeonly>

Revision as of 21:58, 20 December 2019

Experimenting with a template found on MediaWiki.
Used to provide images with captions as an alternative to the ugly ones with a frame that come with MediaWiki.

ToDo: Rename to "File Title" to imply this template is used with "File:..." syntax.

Usage

  • file= Sets which file to use. Default value is 1AKC Samoyed Dog Show 2011.jpg.
  • width= width of the image.
  • height= height of the image
  • align= Sets alignment of image and caption block. Options are right, left, center, and none. Default is right.
  • caption= Places a caption beneath the image, and also serves as the alt text. Optional.
  • padding= 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".
{{Img Title
|file  - the filename of the image
|50              - width
|50              - height
}}

Example

{{Img Title|Influencers.svg|50|50}}

Gives the image at the top right of this page. Template:Img Title