Template:PixelImage: Difference between revisions

From I-Pixelmon
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<!-- =================  Template:PixelImage  ================= -->
<includeonly>
<includeonly>
{{#if: {{{wiki|}}}{{#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|}}}}| | _}}]]|[[File:{{{filename}}}|{{{size|24}}}px|class=pixelated|link={{{display|{{#replace:{{{filename}}}|.png|}}}}}]]}}|[[File:{{{filename}}}|{{{size|24}}}px|class=pixelated|link={{{display|{{#replace:{{{filename}}}|.png|}}}}}]]}}{{#if: {{{display|}}}|{{#ifeq: {{{wiki|}}} | minecraft|[https://minecraft.wiki/w/{{#replace:{{{display}}}| | _}} {{{display}}}]|[[{{{display}}}]]}}}}
<!-- ──────────────────────────────────────────────────────────
    Branch A – we have display text
────────────────────────────────────────────────────────────── -->
{{#if: {{{display|}}} |
  {{#switch: {{{wiki|}}}
  | minecraft =                    <!-- external link -->
      [[File:{{{filename}}}|{{{size|24}}}px|class=pixelated
        |link=https://minecraft.fandom.com/wiki/{{#replace:{{{display}}}| | _}}]]
      [https://minecraft.fandom.com/wiki/{{#replace:{{{display}}}| | _}} {{{display}}}]
  | pixelmon =                      <!-- internal link -->
      [[File:{{{filename}}}|{{{size|24}}}px|class=pixelated
        |link={{#replace:{{{display}}}| | _}}]]
      [[{{{display}}}]]
  | #default =                      <!-- no linking -->
      [[File:{{{filename}}}|{{{size|24}}}px|class=pixelated]]
      {{{display}}}
  }}
 
<!-- ──────────────────────────────────────────────────────────
    Branch B – no display text (icon-only, never linked)
────────────────────────────────────────────────────────────── -->
| [[File:{{{filename}}}|{{{size|24}}}px|class=pixelated]]
}}
</includeonly>
</includeonly>
<noinclude>
<noinclude>
== Usage ==
== Usage ==
<pre><nowiki>{{PixelImage
<pre><nowiki>{{PixelImage
|filename=MyImage.png
|filename = MyImage.png       <!-- required -->
|display=My Display Name
|display = Diamond Pickaxe    <!-- optional -->
|size=32
|size     = 32                 <!-- optional, defaults 24 -->
|wiki=minecraft
|wiki     = minecraft         <!-- optional: minecraft / pixelmon / ”” -->
}}</nowiki></pre>
}}</nowiki></pre>


: • **filename** (required): the exact file name (including extension), e.g. `Minecraft-goldenaxe.png`.
;Parameters
: • **display** (optional): the text to show next to the icon. If omitted, no text is shown.
* <code>filename</code> – **required**. Exact file name, including extension.
: • **size** (optional): width in pixels; defaults to 24.   
* <code>display</code> – optional. Text to show next to the icon.
: • **wiki** (optional): if set to `minecraft`, both icon and display link to the Minecraft Wiki article; otherwise, they link to our wiki.
  If omitted, only the icon is shown and it is **not** a link.
* <code>size</code> – optional. Width (px). Defaults to 24 px.
* <code>wiki</code> – optional.   
  **minecraft** icon + text link to Minecraft Wiki
  **pixelmon**  → icon + text link internally. 
  anything else → no links.


== Examples ==
== Examples ==
test text
* <code>{{PixelImage|filename=Minecraft-goldenaxe.png}}</code> 
{{PixelImage|filename=Minecraft-goldenaxe.png}} this is a test
  → 24 px icon, no link, no text.
test text
 
Renders a 24 px icon of “Minecraft-goldenaxe.png” that links internally to page `Minecraft-goldenaxe` (no text).
* <code>{{PixelImage|filename=Minecraft-goldenaxe.png|display=Golden Axe}}</code> 
test text
  → icon + text “Golden Axe”, no links.
{{PixelImage|filename=Minecraft-goldenaxe.png|display=Golden Axe}}
test text
Renders a 24 px icon and text “Minecraft Golden Axe,” both linking internally to page `Minecraft Golden Axe`. 
test text
{{PixelImage|filename=Minecraft-goldenaxe.png|display=Golden Axe|size=32|wiki=minecraft}}
test text
Renders a 32 px icon of the “Golden Axe,” and “Golden Axe” text—both linking to 
`https://minecraft.fandom.com/wiki/Minecraft-GoldenAxe`.


* <code>{{PixelImage|filename=Minecraft-goldenaxe.png|display=Golden Axe|size=32|wiki=minecraft}}</code> 
  → 32 px icon + text, both link to 
  <nowiki>https://minecraft.fandom.com/wiki/Golden_Axe</nowiki>
</noinclude>
</noinclude>

Revision as of 05:19, 1 June 2025



Usage

{{PixelImage
|filename = MyImage.png        <!-- required -->
|display  = Diamond Pickaxe    <!-- optional -->
|size     = 32                 <!-- optional, defaults 24 -->
|wiki     = minecraft          <!-- optional: minecraft / pixelmon / ”” -->
}}
Parameters
  • filename – **required**. Exact file name, including extension.
  • display – optional. Text to show next to the icon.
 If omitted, only the icon is shown and it is **not** a link.
  • size – optional. Width (px). Defaults to 24 px.
  • wiki – optional.
 **minecraft** → icon + text link to Minecraft Wiki.  
 **pixelmon**  → icon + text link internally.  
 anything else → no links.

Examples


 → 24 px icon, no link, no text.

     Golden Axe


 → icon + text “Golden Axe”, no links.

     Golden Axe


 → 32 px icon + text, both link to  
 https://minecraft.fandom.com/wiki/Golden_Axe