Image Maps -- How To?

ambere - November 26, 2007 - 20:28

Are you able to create image maps in Drupal?

If so, how do you?

Reply much appreciated.

=-=

VM - November 26, 2007 - 20:39

An image map would be generated by you manually, then called into a page if you desired. Drupal doesn't automagically take an image and turn it in to a map for you.

I created the html in

ambere - November 26, 2007 - 20:49

I created the html in DreamWeaver and copied the html code over into the HTML option under primary content. It wouldn't save the html I added.

=-=

VM - November 26, 2007 - 20:53

You have to edit the node and expand the input format menu, and choose the FULL HTML filter so that the HTML isn't stripped out of the node.

image not showing up

emersonlenon - December 12, 2007 - 21:52

Thanks for the helpful post.
I am having a problem getting the image to show up.
I am using Full HTML and calling the following tag:

<img src="/files/mainmap.png" border="0" usemap="#map" />

the file is in the files directory but when i load the page the content is blank.

Thanks

your image tag looks

WorldFallz - December 13, 2007 - 19:12

your image tag looks ok.... post the map html also....

Still no Joy

Jabzebedwa - December 20, 2007 - 14:16

Hello,

I have allowed the tags: in Site Configuration / Input formats
I notice below where I am posting this that in the list of allowed HTML tags that area and map are not included. But it appears from this thread that they are being used with some success by others.

The images shows but there are no links. The URL is http://www.uvita.biz/node/66

Many thanks for any help,

Ben

=-=

VM - December 20, 2007 - 15:11

goto administer -> input formats

add the tags to the input format you are using or submit that node with the FULL HTML input format.

some helpful (hopefully) image map info

WorldFallz - November 26, 2007 - 21:19

I make extensive use of image maps on my intranet site. One thing you should know is that TinyMCE on IE7 mangles the AREA tag (even with a correct extended elements configuration for tiny). I've alerted them over at moxiecode and it does indeed seem to be a legit bug. It's only a problem if you're using TinyMCE and enable the editor on a page with an image map in IE7 (not sure about other versions of IE I only have access to 7). In firefox it's fine (what else is new).

Also, as some of my users don't have access to FULL HTML I added the image map tags into the acceptable html tags for filtered HTML.

One other thing-- someone is working on an image map plugin for TinyMCE over at http://tinymce.moxiecode.com/punbb/viewtopic.php?id=6717. Scroll down to the bottom of the thread-- there's a link down there. It's pretty rough but it does work (at least on FF, with IE7 you still have the same problem with the AREA tag mentioned above).

ImageMap

MerlynMM - September 25, 2008 - 04:58

I am trying to work on a state map that has different counties and have a set of buttons that return county ids OnClick, I need to show icon image with in that county area. Is this possible? Any help would be much appreciated!

Thanks

Problem using imagemaps

seige - November 4, 2008 - 19:14

Hi,

I am having a hard time embedding images with image-maps in them. The problem is that the html (the area tags) is there but I see no links on the image.
I am using TinyMCE with full HTML but I dont think that would be a problem as the HTML has tags correctly present.

Please let me know if somebody knows about it.

Did anyone find out a way to do this ?

This is the html on my page:

seige - November 4, 2008 - 19:20

This is the html on my page:

<img src="/files/research/images/research network.jpg" alt="Research Groups" width="599" height="503" />
<map id="Map" name="Map">
<area shape="rect" coords="276,49,408,134" href="/research/comp-math.html"></area>
<area shape="rect" coords="434,141,589,210" href="/research/mathed.html"></area>
<area shape="rect" coords="444,248,590,321" href="/research/numbers.html"></area>
<area shape="rect" coords="368,327,470,387" href="/research/analysis.html"></area>
<area shape="poly" coords="299,386,279,447,306,474,368,489,422,482,474,466,492,427" href="/research/control.html"></area>
<area shape="rect" coords="68,341,219,410" href="/research/discrete.html"></area>
<area shape="rect" coords="32,221,185,295" href="/research/chaos.html"></area>
<area shape="rect" coords="102,127,249,175" href="/research/stat.html"></area>
</map>

You've not connected your

WorldFallz - November 4, 2008 - 20:03

You've not connected your IMG tag to the map-- you need to add 'usemap="#Map"' to your IMG tag.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

Ahhh True! stupid of me not

seige - November 5, 2008 - 19:50

Ahhh True!

stupid of me not to observe that. However, When i add the tag now, it gets erased when i hit "Submit" and i am back to my problem.

I am using TinyMCE and i Tried this with Full HTML and Unfiltered HTML support both but it didnt work.

Try it with tinymce

WorldFallz - November 5, 2008 - 19:54

Try it with tinymce disabled-- iirc there's some additional config you need to do to tell tiny not to strip out the map tag. I believe i saw it over at the moxiecode forums (trying searching "image map").

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

I got it working! TINYMCE

seige - November 5, 2008 - 20:10

I got it working! TINYMCE cleanup was enabled which was removing the tag.

FYI a tinyMCE plugin for image map seems to work

webengr - November 21, 2008 - 20:56

November 21, 2008,

I am using drupal 5.12 with dev version of tinymce module and tinymce 3.x version
and I got a beta image map plugin on the google code site to work....

This webpage has code
http://code.google.com/p/imgmap/

This webpage explains install somewhat...
http://code.google.com/p/imgmap/wiki/TinyMCE_setup

NOTE
the zIp was not is a sub directory by itself so careful
where you unzip! The beta zip I reviewed did not yet
have a readme nor notes I could see, it is beta...
and the zip had more zips inside for different editors...

It is a tinymce plugin so you go to the plugin folder...
and create a directory imgmap, then extract zip inside the folder.
So from your modules folder the path:
./tinymce/tinymce/jscripts/tiny_mce/plugins/imgmap

I also beleive for tinymce we are suppose to also unzip the appropriate
zip file in same folder with additional files for editor, for my case:
unzip plugin_tinymce3.78.zip

For the steps about settinup instance and button, I think
they are referring to the plugin_reg.php which
is part of the drupal tinymce module, ./modules/tinyce/plugin_reg.php

And I added this near the bottom:

$plugins['imgmap'] = array();
$plugins['imgmap']['theme_advanced_buttons3'] = array('imgmap');
$plugins['imgmap']['extended_valid_elements'] = array('img[usemap|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]');

Another note....
the button did not show up on firefox 3, untill I deleted my profile and its files then recreated it,
but did show up on IE! That is a firefox issue that I saw on other tinymce 3.x issues...

On firefox to delete profile reference:
http://kb.mozillazine.org/Profile_Manager
( w/o firefox open from run line, firefox -profilemanager )

Hope this helps.

FYI-- the same site linked

WorldFallz - November 22, 2008 - 04:50

FYI-- the same site linked above (http://code.google.com/p/imgmap) also has an fckeditor plugin and it works well. I used the current 2.x branch of the fckeditor module with the 2.6.3 version of fckeditor.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

FYI seems to works for tiny_mce replacement module wyiwyg

webengr - January 27, 2009 - 16:35

IF you did not know this already... the tinymce module is deprecated by the wysiwyg module.

I was able to get the imgmap plugin to work for that module it seems...

After putting the proper unzip in the proper tinymce folder,
had to edit sites/all/modules/wysiwyg/editors/tinymce.inc instead of the old plugin_reg.php

    // added after table plugin array description for img support
    // pep, http://code.google.com/p/imgmap/wiki/TinyMCE_setup
    'imgmap' => array(
      'path' => $editor['library path'] .'/plugins/imgmap',
      'buttons' => array('imgmap' => t('Image Map')),
      'extended_valid_elements' => array('img[usemap|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseove
r|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]'),
      'url' => 'http://code.google.com/p/imgmap/',
      'internal' => TRUE,
      'load' => TRUE,
    ),
    // end mod for imgmap

I added the imgmap functionality by adding these lines too...BUT

davedickens - April 4, 2009 - 06:47

I got the button to work in TinyMCE by adding the imgmap lines to tinymce.inc without a hitch. (and this seems to be the default methodology for adding buttons for any of the advanced tinymce 3rd party functions...as it also is in TinyMCE withOUT the Wysiwyg module...which is part of the tinymce init string...a feature by design)

However when I would submit my page...no image map. I struggled, read, cut, pasted, tried different themes, got lost in the moxiecode forums...but nothing was ringing true for me.

Then I got to looking at the source html on pages with a working image map, and noticed that sometimes the array and area attributes were miles away at the bottom of a page of html code, outside of any div tags or other containers.

Then it dawned on me that the NECCESSARY initial parameter that specifies that an imagemap is about to "happen" is actually a part of the img attribute.

So to get this to work, we have to get the usemap parameter registered to render itself within the img attribute before IE or FF or chrome even start looking for areas or arrays.

So after a pack of marlboro lights and a pot of coffee, I just typed in 6 more characters to tinymce.inc to make it work.

I added the usemap parameter to the img attribute in the advimage part of the tinymce.inc.

Like so:
'extended_valid_elements' => array('img[usemap|src|alt|title|align|width|height|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'),

Then I got so emboldened that I went one step further and added onmouseover|onmouseout|title to the end of the area attribute of the imgmap button like so:
'extended_valid_elements' => array('img[usemap|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target|
onmouseover|onmouseout|title]'),

And this gave me the ability to add highlighting and popup titles to my imagemap as well. (which has to be handcoded via the html screen...but at least they are there now)

I hope this helps anyone else who struggled with this like I did.

-God is in the freakin' details.

WorkAround

ankit4u - March 22, 2009 - 16:05

I created a new filter input as "PLain HTML". Unselected all the filters, so that nothing gets filtered out. And selected this filter format while creating my node and it worked!! There is a security risk, but I had given perm to none ie only admin.

jQuery Map Hilight

khan2ims - September 8, 2009 - 07:49

You might be interested in checking this out

http://drupal.org/project/jq_maphilight

Imran Khan
Project Manager
New Earth Marketing

Imran Khan
Project Manager
New Earth Marketing

 
 

Drupal is a registered trademark of Dries Buytaert.