Difference between revisions of "Template:ImageTG"

From Species-ID
Jump to: navigation, search
Line 2: Line 2:
 
** First store values for 100% scaling (note: both parts of #if: are evaluated, so vardefine can never be inside an expression! Searching for both possible writings, with or without underscore; <nowiki> </nowiki> used to represent a non-trimmable blank)  **
 
** First store values for 100% scaling (note: both parts of #if: are evaluated, so vardefine can never be inside an expression! Searching for both possible writings, with or without underscore; <nowiki> </nowiki> used to represent a non-trimmable blank)  **
 
-->{{
 
-->{{
#vardefine:tgpx1|0+<!--
+
#vardefine:tgpx1|<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_10x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>10x.}} | 589}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_10x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>10x.|0}} | 589}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_20x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>20x.}} | 589}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_20x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>20x.|0}} | 589}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_40x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>40x.}} | 595}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_40x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>40x.|0}} | 595}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_63x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>63x.}} | 354}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_63x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>63x.|0}} | 354}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_100x.}}+ {{#pos:{{{1}}}|<nowiki> </nowiki>100x.}}| 295}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}}|_100x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>100x.|0}}| 295}}<!--
 
-->}}{{
 
-->}}{{
 
#vardefine:tglabel|<!--
 
#vardefine:tglabel|<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_10x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>10x.}} | 200 µm}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_10x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>10x.|0}} | 200 µm}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_20x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>20x.}} | 100 µm}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_20x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>20x.|0}} | 100 µm}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_40x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>40x.}} |  50 µm}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_40x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>40x.|0}} |  50 µm}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_63x.}} + {{#pos:{{{1}}}|<nowiki> </nowiki>63x.}} |  20 µm}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}} |_63x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>63x.|0}} |  20 µm}}<!--
-->{{#ifexpr:{{#pos:{{{1}}}|_100x.}}+ {{#pos:{{{1}}}|<nowiki> </nowiki>100x.}}|  10 µm}}<!--
+
-->{{#ifexpr:{{#pos:{{{1}}}|_100x.|0}} + {{#pos:{{{1}}}|<nowiki> </nowiki>100x.|0}}|  10 µm}}<!--
 
-->}}<!--
 
-->}}<!--
 
** The pixel values above are for full size display and must be corrected for images scaling **
 
** The pixel values above are for full size display and must be corrected for images scaling **

Revision as of 21:56, 17 December 2008


Description

This template is a specialized template to render a specific kind of microscopic photos by T. Gräfenhan. The major function of this template is to calculate a scale bar correctly for the magnification factors signaled by a special code ("_63x.") in the file name. Other images may have different naming conventions; the template may then be copied to a different name and the code adjusted. The images have a maximum size of 2560px if uncropped, but may be cropped.

Parameters

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

Usage

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


Dependendencies

Depends on Extension:StringFunctions, Extension:MediaFunctions, Extension:Variables.