I have an image that I have created using the new image draw functions, but I need to have separate areas of the image as links to other pages. I know that the html map tag can be used to do this, but the problem is I can only get it to work if I hardcode the coordinates, but what I need is to use coldfusion variables as the coordinates as the images are drawn dynamically. Is there any way to do this, or a suitable alternative?
How are you outputting the map? Not sure how you have your variables structured, but here's some pseudo code: <cfoutput> <MAP NAME="map1"> <cfloop collection="#imageMap#" item="mapItem"> <AREA HREF="#mapItem.href#" ALT="#mapItem.alt#" TITLE="#mapItem.title#" SHAPE="#mapItem.shape#" COORDS="#mapItem.coords#"> </cfloop> </MAP> </cfoutput> Send some code so we can see...
Here's my map code: <img src="test8.jpg" width="1050" height="200" border="0" usemap="#Map"> <map name="Map"> <area shape="rect" coords="#x1#,#y1#,27,175" href="details.cfm?marker_id=#marker_id#"> </map> The variables used as the coordinates have been declared and had values assigned, but the map tag won't evaluate them and use them correctly. If I use this however: <img src="test8.jpg" width="1050" height="200" border="0" usemap="#Map"> <map name="Map"> <area shape="rect" coords="20,168,27,175" href="details.cfm?marker_id=A1234"> </map> Then all works fine.
Have just taken second look at your reply and realised I've made fundamental beginner programmer's error... I forgot to put cfoutput tags around the variables. hmmm, feel bit dumb now, but thanks for your reply as I spotted my mistake from that!