Template:PixelImage: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
[[File:{{{filename}}}|{{{size|24}}}px|class=pixelated]] | {{#if: {{{wiki|}}} | ||
</includeonly><noinclude> | | <!-- If “wiki” is provided --> | ||
{{#ifeq: {{{wiki}}} | minecraft | |||
| <!-- Link icon to the Minecraft Wiki page (using display or filename base) --> | |||
[[File:{{{filename}}}|{{{size|24}}}px|class=pixelated | |||
|link=https://minecraft.fandom.com/wiki/{{#replace:{{{display|{{#replace:{{{filename}}}|.png|}}}}| | _}}]] | |||
| <!-- “wiki” is provided but not “minecraft”: link icon internally to our wiki page (display or filename base) --> | |||
[[File:{{{filename}}}|{{{size|24}}}px|class=pixelated | |||
|link={{{display|{{#replace:{{{filename}}}|.png|}}}}}]] | |||
}} | |||
| <!-- “wiki” not provided: link icon internally to page named by display or filename base --> | |||
[[File:{{{filename}}}|{{{size|24}}}px|class=pixelated | |||
|link={{{display|{{#replace:{{{filename}}}|.png|}}}}}]] | |||
}} | |||
{{#if: {{{display|}}} | |||
| <!-- If “display” is provided, render it as a link --> | |||
{{#ifeq: {{{wiki|}}} | minecraft | |||
| <!-- Link text to Minecraft Wiki --> | |||
[https://minecraft.fandom.com/wiki/{{#replace:{{{display}}}| | _}} {{{display}}}] | |||
| <!-- Link text internally to our wiki --> | |||
[[{{{display}}}]] | |||
}} | |||
}} | |||
</includeonly> | |||
<noinclude> | |||
== Usage == | == Usage == | ||
<pre><nowiki>{{PixelImage|filename=MyImage.png|size= | <pre><nowiki>{{PixelImage | ||
: • **filename** (required): the file name including extension, e.g. `Minecraft_golden_axe.png` | |filename=MyImage.png | ||
: • **size** (optional): width in pixels, | |display=My Display Name | ||
|size=32 | |||
|wiki=minecraft | |||
}}</nowiki></pre> | |||
: • **filename** (required): the exact file name (including extension), e.g. `Minecraft_golden_axe.png`. | |||
: • **display** (optional): the text to show next to the icon. If omitted, no text is shown. | |||
: • **size** (optional): width in pixels; defaults to 24. | |||
: • **wiki** (optional): if set to `minecraft`, both icon and display link to the Minecraft Wiki article; otherwise, they link to our wiki. | |||
== Examples == | |||
* `{{PixelImage|filename=Minecraft_golden_axe.png}}` | |||
: Renders a 24 px icon of “Minecraft_golden_axe.png” that links internally to page `Minecraft_golden_axe` (no text). | |||
* `{{PixelImage|filename=Minecraft_golden_axe.png|display=Minecraft Golden Axe}}` | |||
: Renders a 24 px icon and text “Minecraft Golden Axe,” both linking internally to page `Minecraft Golden Axe`. | |||
* `{{PixelImage|filename=Minecraft_golden_axe.png|display=Minecraft Golden Axe|size=32|wiki=minecraft}}` | |||
: Renders a 32 px icon of the “Minecraft Golden Axe,” and “Minecraft Golden Axe” text—both linking to | |||
: `https://minecraft.fandom.com/wiki/Minecraft_Golden_Axe`. | |||
</noinclude> | </noinclude> | ||
Revision as of 00:34, 31 May 2025
Usage
{{PixelImage
|filename=MyImage.png
|display=My Display Name
|size=32
|wiki=minecraft
}}
- • **filename** (required): the exact file name (including extension), e.g. `Minecraft_golden_axe.png`.
- • **display** (optional): the text to show next to the icon. If omitted, no text is shown.
- • **size** (optional): width in pixels; defaults to 24.
- • **wiki** (optional): if set to `minecraft`, both icon and display link to the Minecraft Wiki article; otherwise, they link to our wiki.
Examples
- `
`
- Renders a 24 px icon of “Minecraft_golden_axe.png” that links internally to page `Minecraft_golden_axe` (no text).
- `
`
- Renders a 24 px icon and text “Minecraft Golden Axe,” both linking internally to page `Minecraft Golden Axe`.
- `
`
- Renders a 32 px icon of the “Minecraft Golden Axe,” and “Minecraft Golden Axe” text—both linking to
- `https://minecraft.fandom.com/wiki/Minecraft_Golden_Axe`.