Widget:HtmlImageMap: Difference between revisions

From sandbox
Jump to navigation Jump to search
Gfc (talk | contribs)
No edit summary
Gfc (talk | contribs)
No edit summary
Line 1: Line 1:
<noinclude>
<noinclude>
This widget allows you to create a clickable image map using raw HTML.
This widget allows you to create an image map by pasting raw HTML area coordinates.
Usage:  
Usage:
 
{{#widget:HtmlImageMap
{{#widget:HtmlImageMap
|image=Name_of_image.jpg
|image=YourImageFileName.png
|width=500
|width=800
|alt=Description
|mapname=sandboxmap
|mapname=mymap
|areas=
|coords1=0,0,100,100
<area shape="rect" coords="300,80,450,220" href="https://example.com" title="Electronics">
|link1=https://yourwiki.com
<area shape="rect" coords="480,110,580,240" href="https://example.com" title="Crafting">
|title1=Page 1
}}
}}
</noinclude>
</noinclude>
<includeonly>
<includeonly>
<!-- HTML Image Map Structure -->
<!-- Automatically resolves the full path of your wiki file -->
<img src="{$image|escape:'url'}" width="{$width|escape:'html'}" alt="{$alt|escape:'html'}" usemap="#{$mapname|escape:'html'}">
<img src="{{canonicalurl:Special:FilePath/{$image}}}" width="{$width|escape:'html'}" usemap="#{$mapname|escape:'html'}" alt="Makerspace Map">


<map name="{$mapname|escape:'html'}">
<map name="{$mapname|escape:'html'}">
  <!-- Area 1 (Rectangle) -->
   {$areas}
   {if isset($coords1) && isset($link1)}
    <area shape="rect" coords="{$coords1|escape:'html'}" href="{$link1|escape:'html'}" alt="{$title1|escape:'html'}" title="{$title1|escape:'html'}">
  {if}
 
  <!-- Area 2 (Circle) -->
  {if isset($coords2) && isset($link2)}
    <area shape="circle" coords="{$coords2|escape:'html'}" href="{$link2|escape:'html'}" alt="{$title2|escape:'html'}" title="{$title2|escape:'html'}">
  {if}
</map>
</map>
</includeonly>
</includeonly>

Revision as of 22:54, 13 October 2026

This widget allows you to create an image map by pasting raw HTML area coordinates. Usage: Makerspace Map