Jump to content

Specs/HTML/2.5.0/Extensions/ImageMap

From mediawiki.org
  • T292657: mw-file-description added to media links to the file description page, which is the default
  • T272186: Add noresize class on imagemaps
  • T290044: Force block imagemaps



The basic idea is to keep the same structure as what's expected for media in general, with the addition of the <map> element.

For example, this imagemap:

<imagemap>
File:Foobar.jpg
poly 10.1 10.9 10 30 -30 15 [[Main Page]]
</imagemap>

Renders as:

<figure class="mw-default-size noresize" typeof="mw:File mw:Extension/imagemap" about="#mwt3" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg\n\npoly 10.1 10.9 10 30 -30 15 [[Main Page]]\n"}}'>
    <span>
        <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" usemap="#ImageMap_02c94d3ca4bfc187"/>
    </span>
    <map name="ImageMap_02c94d3ca4bfc187">
        <area href="./Main_Page" shape="poly" coords="10,11,10,30,-30,15"/>
    </map>
    <figcaption></figcaption>
</span>

If a caption is present, we get:

<imagemap>
File:Foobar.jpg|thumb|This is a test.
poly 10.1 10.9 10 30 -30 15 [[Main Page]]
default [[Other Page]]
</imagemap>

Rendered as:

<figure class="mw-default-size noresize" typeof="mw:File/Thumb mw:Extension/imagemap" about="#mwt3" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|thumb|This is a test.\npoly 10.1 10.9 10 30 -30 15 [[Main Page]]\ndefault [[Other Page]]\n"}}'>
    <a href="./Other_Page">
        <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" usemap="#ImageMap_a1a7270c874f787e"/>
    </a>
    <map name="ImageMap_a1a7270c874f787e">
        <area href="./Main_Page" shape="poly" coords="10,11,10,30,-30,15"/>
    </map>
    <figcaption>This is a test.</figcaption>
</figure>