Difference between revisions of "Template:ImageTG"
From Species-ID
Line 19: | Line 19: | ||
-->{{ | -->{{ | ||
#vardefine:tgpx2| | #vardefine:tgpx2| | ||
− | {{#expr: {{#var:tgpx1}} * | + | {{#expr: {{#var:tgpx1}} * {{ |
− | + | #if: {{#pos: {{{width|250px}}} |px}} | |
|<!--then: is px-number, strip px ####NOT YET DONE!### and calculate ratio:--> {{{width}}} / {{#mediawidth: {{{1}}} }} | |<!--then: is px-number, strip px ####NOT YET DONE!### and calculate ratio:--> {{{width}}} / {{#mediawidth: {{{1}}} }} | ||
|<!--else: percent-number: --> {{{width|100}}} / 100 | |<!--else: percent-number: --> {{{width|100}}} / 100 | ||
Line 27: | Line 27: | ||
<!--(end vardefine)-->}}<!-- | <!--(end vardefine)-->}}<!-- | ||
** Now insert into image template: ** | ** Now insert into image template: ** | ||
− | -->{{Image | {{{1|Please enter the image filename as 1st parameter!}}} AFTERIMAGE | + | -->{{Image | {{{1|Please enter the image filename as 1st parameter!}}} AFTERIMAGE """{{#var:tgpx2}}""" |
| width = {{{width|250px}}}<!-- | | width = {{{width|250px}}}<!-- | ||
** pass-through up to 6 further parameters (thumb, left, upright, etc. plus caption; first unnamed parameter 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): ** |
Revision as of 21:48, 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.