This wiki is closed in favour of the new wiki. Information shown is likely to be very out of date. |
Difference between revisions of "Template:Thumbmaker"
(Created page with "{{#ifexist:File:{{{1|2}}}.png|[[Image:{{{1|2}}}.png|thumb|120px|{{{2|}}}]]|{{#ifexist:File:{{{1|2}}}.jpg|[[Image:{{{1|2}}}.jpg|thumb|120px|{{{2|}}}]]|<span style="font-size: 9...") |
|||
(19 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{#ifexist:File:{{{ | + | <noinclude><!--</noinclude> |
+ | {{#ifexist:File:{{#if:{{{2|}}}|{{{2}}}|{{{1}}}}}.png|[[Image:{{#if:{{{2|}}}|{{{2}}}|{{{1}}}}}.png|thumb|{{#if:{{{3|}}}|{{{3}}}|120px}}|{{{1}}}]]|{{#ifexist:File:{{#if:{{{2|}}}|{{{2}}}|{{{1}}}}}.jpg|[[Image:{{#if:{{{2|}}}|{{{2}}}|{{{1}}}}}.jpg|thumb|{{#if:{{{3|}}}|{{{3}}}|120px}}|{{{1}}}]]|<span style="font-size: 90%; border: 1px solid #202653; background-color: #14193F; padding: 5px">Please [[File:{{#if:{{{2|}}}|{{{2}}}|{{{1}}}}}.png|upload]] an image of {{{1}}}.</span>}}}} | ||
+ | <noinclude>--> __NOEDITSECTION__ | ||
+ | This template attempts to display a thumbnail of a named item, and prompts the user to upload an image if a file cannot be located. | ||
+ | |||
+ | Specifically, the template takes three parameters, which are referred to here as Item Name, Filename, and Size, respectively. Only the Item Name is required. | ||
+ | |||
+ | In the default scenario, a Filename is '''''not''''' provided, and the template looks for a File: entry named "Item Name.png" and then "Item Name.jpg", in that order. But if a Filename parameter is provided, the template looks for File: entries named "Filename.png" and "Filename.jpg", in that order. This allows the user to sipmly specify the Item Name and have the template find the image automatically, or the user can specify an alternative image if they want to use something else. | ||
+ | |||
+ | Assuming a File: entry is located, the Image: template is then called upon to display a thumbnail image of the discovered file, with Item Name as the caption value. If a Size parameter is provided, that value is passed to the Image: template as the thumbnail size parameter. If a Size parameter is not provided, a default value of 120px is used. | ||
+ | |||
+ | If an image cannot be found, a text string is displayed that requests the user to upload a PNG version of the Item Name, or the Filename if one was specified. | ||
+ | |||
+ | Note that the Image: template uses CSS that aligns the thumbnail on the right edge of the page with a left margin. If you want to reposition the thumbnail, you need to enclose it in a <div> tag. | ||
+ | |||
+ | ==Usage== | ||
+ | <pre>{{Thumbmaker|Planet Manhattan}} | ||
+ | {{Thumbmaker|Planet Manhattan|Planet_Malta}} | ||
+ | {{Thumbmaker|Planet Manhattan|Planet_Malta|200px}} | ||
+ | <div style="float: left; clear: both;">{{Thumbmaker|Planet Manhattan|Planet_Malta|200px}}</div></pre> | ||
+ | |||
+ | ==Result== | ||
+ | {{Thumbmaker|Planet Manhattan}} | ||
+ | {{Thumbmaker|Planet Manhattan|Planet_Malta}} | ||
+ | {{Thumbmaker|Planet Manhattan|Planet_Malta|200px}} | ||
+ | <div style="float: left; clear: both;">{{Thumbmaker|Planet Manhattan|Planet_Malta|200px}}</div> | ||
+ | |||
+ | [[Category:Templates]] | ||
+ | </noinclude> |
Latest revision as of 19:42, 20 December 2012
This template attempts to display a thumbnail of a named item, and prompts the user to upload an image if a file cannot be located.
Specifically, the template takes three parameters, which are referred to here as Item Name, Filename, and Size, respectively. Only the Item Name is required.
In the default scenario, a Filename is not provided, and the template looks for a File: entry named "Item Name.png" and then "Item Name.jpg", in that order. But if a Filename parameter is provided, the template looks for File: entries named "Filename.png" and "Filename.jpg", in that order. This allows the user to sipmly specify the Item Name and have the template find the image automatically, or the user can specify an alternative image if they want to use something else.
Assuming a File: entry is located, the Image: template is then called upon to display a thumbnail image of the discovered file, with Item Name as the caption value. If a Size parameter is provided, that value is passed to the Image: template as the thumbnail size parameter. If a Size parameter is not provided, a default value of 120px is used.
If an image cannot be found, a text string is displayed that requests the user to upload a PNG version of the Item Name, or the Filename if one was specified.
Note that the Image: template uses CSS that aligns the thumbnail on the right edge of the page with a left margin. If you want to reposition the thumbnail, you need to enclose it in a <div> tag.
Usage
{{Thumbmaker|Planet Manhattan}} {{Thumbmaker|Planet Manhattan|Planet_Malta}} {{Thumbmaker|Planet Manhattan|Planet_Malta|200px}} <div style="float: left; clear: both;">{{Thumbmaker|Planet Manhattan|Planet_Malta|200px}}</div>
Result