Hello everybody,

I have a cfm template which I refer to in the <img> src tag (<img 
src="OutputImage.cfm" border="1" />) . It outputs the image correctly and as I 
would expect it to. Here is the code:

OutputImage.cfm
----------------

<cfscript>
Context = getPageContext();
Context.setFlushOutput(false);

Response = Context.getResponse().getResponse();
OutputStream = Response.getOutputStream();
Response.setContentType("image/jpeg");

OutputImage(session.sessionid,'en',OutputStream);

OutputStream.flush();
OutputStream.close();
</cfscript>

However, when I move the exact same code to a function in a CFC and call it, 
nothing but the image gets outputted in the browser. Any ideas why this is the 
case? Is there a different way to call the GetPageContext() method within a CFC?

Here is the call:

<img src="#request.RenderImage()#" border="1" />

Here is the same code in a cfc.

<cfcomponent displayname="ImageRenderer">
<cffunction name="RenderImage" returntype="void" access="public" output="true">
        <cfscript>
        Context = getPageContext();
        Context.setFlushOutput(false);
        
        Response = Context.getResponse().getResponse();
        OutputStream = Response.getOutputStream();
        Response.setContentType("image/jpeg");
        
        OutputImage(session.sessionid,'en',OutputStream);
        
        OutputStream.flush();
        OutputStream.close();
        </cfscript>
</cffunction>
</cfcomponent>

I would really appreciate your help.
Regards,
John



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318727
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to