How do you write a image to browser as a binary stream in coldfusion? -


i have service on coldfusion 9 server creates image banners on fly us. separate machine has save these files like:

wget http://myserver.com/services/local/bannercreator/250x250-v3.cfm?prodid=3&percentsaving=19 

the problem can't think of how coldfusion write out binary data without using temporary file. @ minute image displayed image tag this:

<cfimage action = "writetobrowser" source="#banner#" width="#banner.width#" height="#banner.height#" /> 

any ideas? or should use temporary file?

i can't test because you're not giving example code how images generated, have tried along line?

<cfcontent reset="true" variable="#imagedata#" type="image/jpg" /> 

update: went ahead , created own image; i'll assume you're doing similar. works me:

<cfset img = imagenew("",200,200,"rgb","red") /> <cfcontent variable="#tobinary(tobase64(img))#" type="image/png" reset="true" /> 

this works without writing file, , without using virtual file system ("ramdisk")


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -