Jun 23, 2011

CFimage action=write to browser image map - ColdFusion

Cfimage is a nice little tag really usefull for dynamically resizing images, adding overlays, adding text overlays and cropping.

Cfimage action = write to browser is also really nice feature which allows an image to be written to a temporary location and used in a webpage without having to take care of writing it out to disc and all that goes along with that ( creating a unique file name and cleaning up after it's no longer needed ). The result to writetobrowser is a img tag without the ability to modify the properties.

What if you want just a little bit more of of writetobrowser like the ability to say use the image as a image map? You can't...or can you.

Well yes you can. Simply wrap cfsavecontent around the writetobrowser and you now have the img tag and location to the temp image file. You can now manipulate the img tag and output it via cfoutput.

Here is an example



3 comments: