Generate image with CFIMAGE - but need to use img tag to serve the content

I create a new image with cfimage, that already works without
any problems.
But instead of using the action="writetobrowser" I need to be
able to use the script inside a img tag:
Example: <img
src="myscript.cfm?somedata=iwanttheimagetocreate>
I found one webpage that deals with that problem (
http://www.webdevelopernews.com/2007/09/14/serving-up-cfimages-via-image-tags/)
but the image served to the browser, when using the code below, is
of a very low quality and another point is that you can't serve
.gif's to the browser.
<cfcontent type="image/jpg"
variable="#ImageGetBlob(backgroundimage)#">
Any suggestions/solutions?
Thanks,
Phil

In that entry Raymond mentions:
"The WriteToBrowser action actually generates HTML that points
to a ‘magic’ URL to serve the image.". ie <img
src="/CFFileServlet/_cf_image/_cfimg-12345036853711072.PNG" alt=""
/>
Perhaps you could create a function that captures the
generated html by using <cfsavecontent>.
<cfsavecontent variable="imageTagHTML">
<cfimage action="writeToBrower" ..>
</cfsavecontent>
Then uses a regular expression to extract and return the url
portion only. ie
"/CFFileServlet/_cf_image/_cfimg-12345036853711072.PNG"
<cfset ExtractedURLHere = SomeFunction(arguments...)>
<cfoutput><img
src="#ExtractedURLHere#"></cfoutput>
Though you could also use the entire html string directly
<cfoutput>#imageTagHTML#</cfoutput>

Similar Messages

Maybe you are looking for

  • Sub tool in tool bar..

    hi experts, i had developed alv report i want sub total button on tool bar,not in the field catlog.i am getting total button but not sub total.... thanks in advance

  • Any way to get rid of the drop shadow on Screen Captures in Leopard?

    i do a fair bit of procedure documentation work, and so use screen captures quite a lot. Since upgrading to leopard the screen grab tool now puts a 77(ish) pixel white border and drop shadow around the screen captures, which might look trendy for som

  • Why canI open Firefox twice and my Norton toolbar only shows up on the second one

    for some reason i can open firefox twice and did not know if this is normal. also my Norton 360 only shows up on the second one trying to find out if this is a something i need to correct and how to go about it

  • Can't install Flash CS3!

    Hey! I've got a MacBook (about a year old), and when i'm trying to install adobe flash cs3 i get 2 errors, the installation completes but "Adobe Flash CS3 and Adobe Asset Services CS3" failed to install.. I've tried with the free trial and the full v

  • How to enable listbox dynamically in servlets

    Hi everybody, Iam working on Servlets.Iam using two text boxes 1 for accept_qty and other for reject_qty.On entering on the rejected_qty I should be able to enable the rejected_reason which is a List box Is there any way to getr me out of this troubl