HTML Image Map


In this POST, we are going to talk about setting up multiple links within one piece of image.


Above shown images only single peace of images. But when we click on skype, ebay... it should navigate to respective hyper link.

Your html code should contain below format.


<html> <head> <title>Image Map</title> </head> <body>
<img src="images/weblogo.jpg" alt="" usemap="#logos" />
<map name="logos"> <area shape="circle" coords="68,56,33" href="http://www.stumbleupon.com/" title="StumbleUpon" alt="StumbleUpon" /> <area shape="rect" coords="220,19,306,54" href="http://www.youtube.com/" title="Youtube" alt="Youtube" /> <area shape="rect" coords="367,32,516,84" href="http://www.google.com/" title="Google" alt="Google" /> <area shape="rect" coords="556,12,639,115" href="http://www.wikipedia.com/" title="Wikipedia" alt="Wikipedia" /> <area shape="rect" coords="128,62,244,114" href="http://www.skype.com/" title="Skype" alt="Skype" /> <area shape="rect" coords="301,103,444,136" href="http://www.yahoo.com/" title="Yahoo" alt="Yahoo" /> <area shape="rect" coords="25,158,135,207" href="http://www.ebay.com/" title="eBay" alt="eBay" /> <area shape="rect" coords="180,147,271,175" href="http://www.flickr.com/" title="Flickr" alt="Flickr" /> <area shape="rect" coords="299,166,379,208" href="http://www.digg.com/" title="Digg" alt="Digg" /> <area shape="circle" coords="500,184,32" href="http://wordpress.org/" title="Wordpress.org" alt="Wordpress.org" /> <area shape="rect" coords="599,142,667,209" href="http://www.blogger.com/" title="Blogger" alt="Blogger" /> <area shape="default" nohref="nohref" title="Default" alt="Default"/> </map>
</body> </html>
Defiantly above code will work for any image. But, Question is how to identify label area on image?
this is very simple.
Download "GIMP" and install in your PC. It's free tool.
1. Open GIMP tool.
2. Open image in GIMP.
3. go to Filters-->Web-->Image Map from GIMP top navigation tools.
4. Right hand side you are able to see 3 types of selection shapes. Depends on your image shapes you need to select area of the image. as shown in the below image.



Now select rectangle for "YouTube" area selection. And double click on selected area immediately. It will popup one properties window as shown below image. You have to give URL & ALT text.



Now click on OK, Apply.

You need repeat these steps for all labeled images.

Now we have to save this image. Go to files and select SaveAs.
Select save location and rename file name as "ImageMap.txt"

Now go to file saved location and open file in notepad.

It contains
<img src="images/weblogo.jpg" alt="" usemap="#logos" />
<map name="logos"> <area shape="circle" coords="220,19,306,54" href="http://www.youtube.com/" title="Youtube" alt="Youtube" />



Now we can use above tags in the HTML code or any SharePoint Content Editor web part pages.

Please reply back with your queries & suggestions.

Comments

Popular posts from this blog

Sending email using Powershell script

Convert List Collection to DataTable using C#

Difference Between Site Template and Site Definition