cfimage tag and functions

Discussion in 'Programming' started by vikingGirl, Dec 10, 2008.

  1. #1
    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?
     
    vikingGirl, Dec 10, 2008 IP
  2. robhustle

    robhustle Peon

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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...
     
    robhustle, Dec 10, 2008 IP
  3. vikingGirl

    vikingGirl Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    vikingGirl, Dec 11, 2008 IP
  4. vikingGirl

    vikingGirl Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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!
     
    vikingGirl, Dec 11, 2008 IP
  5. robhustle

    robhustle Peon

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    As long as it gets solved, who cares, right?

    :)
     
    robhustle, Dec 11, 2008 IP