Difference between revisions of "Template:Image"

From Species-ID
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>[[{{{1|}}}|{{ #if:{{#pos:{{{width|100}}}|px}}|{{{width|100}}}| {{#expr: ({{#imgwidth: {{{image| {{{1}}} }}} }} * {{{width|100}}}) / 100 }}px }}<!--
+
<includeonly>[[{{{1|}}}|{{ #if:{{#pos:{{{width|100}}}|px}}|{{{width|100}}}| {{#expr: ({{#mediawidth: {{{image| {{{1}}} }}} }} * {{{width|100}}}) / 100 }}px }}<!--
pass-through all other parameters; this may be thumb, left, upright, or caption (first unnamed is always the image file):-->{{
+
pass-through up to 6 further parameters (thumb, left, upright, etc. plus caption; first unnamed parameter is always the image file):-->{{
 
#if: {{{2|}}} | {{!}}{{{2}}}
 
#if: {{{2|}}} | {{!}}{{{2}}}
 
}}{{
 
}}{{
Line 14: Line 14:
 
}}]]</includeonly><noinclude>
 
}}]]</includeonly><noinclude>
 
==Description==
 
==Description==
This template work similar to the normal mediawiki image embedding (<nowiki>[[File:x.png|thumb|left|250px|The caption text]]</nowiki>), except it also allows to scale an image by percent. If the parameter "width" is called with a "px" after the number, normal pixel scaling occurs, else the number will be interpreted as percent of original image.
+
This template works similar to the default mediawiki image embedding syntax (<nowiki>[[File:x.png|thumb|left|250px|The caption text]]</nowiki>), except in that it also allows to scale an image as a percentage of the original size. If the parameter "width" is called with a "px" after the number, normal pixel scaling occurs, else the number will be interpreted as percent of the original image.
  
==Usage:==
+
==Parameters==
 +
 
 +
* width: either number + px for fixed width in pixel, or number, interpreted as percentage relative to original size.
 +
* a sequence of unnamed parameters, covering the standard image functionality (thumb, left, caption, etc.).
 +
 
 +
==Dependencies==
 +
 
 +
* Extension:ParserFunctions
 +
* Extension:MediaFunctions
 +
* standard programming templates only.
 +
 
 +
==Usage==
 
* <nowiki>{{Image|File:x.png|Your caption text here|width=250px}}</nowiki>
 
* <nowiki>{{Image|File:x.png|Your caption text here|width=250px}}</nowiki>
* <nowiki>{{Image|File:x.png|thumb|left|width=15|Your caption text}}</nowiki>
+
*: Fully equivalent to: <nowiki>[[File:x.png|250px|Your caption text here]]</nowiki>
 +
* <nowiki>{{Image|File:x.png|thumb|left|width=15|upright|Your caption text}}</nowiki>
 +
*: This scales the image to 15% of original size.
 
</noinclude>
 
</noinclude>

Latest revision as of 00:56, 17 December 2008

Description

This template works similar to the default mediawiki image embedding syntax ([[File:x.png|thumb|left|250px|The caption text]]), except in that it also allows to scale an image as a percentage of the original size. If the parameter "width" is called with a "px" after the number, normal pixel scaling occurs, else the number will be interpreted as percent of the original image.

Parameters

  • width: either number + px for fixed width in pixel, or number, interpreted as percentage relative to original size.
  • a sequence of unnamed parameters, covering the standard image functionality (thumb, left, caption, etc.).

Dependencies

  • Extension:ParserFunctions
  • Extension:MediaFunctions
  • standard programming templates only.

Usage

  • {{Image|File:x.png|Your caption text here|width=250px}}
    Fully equivalent to: [[File:x.png|250px|Your caption text here]]
  • {{Image|File:x.png|thumb|left|width=15|upright|Your caption text}}
    This scales the image to 15% of original size.