Re: Calling GetPageContext within a CFC
Dude, why are you trying to put the image inside the image tag? Isn't that just for the image source, a.k.a. the link to where the image is, and not the actual binary data of the image itself? I mean, if that's what you really want, why not cffile read the image in and output it that way instead of messing with the pageContext. >From what I can tell you're describing is happening, is that when you change the content type to image/jpeg, that becomes the new content type for the whole entire page, even though you put in HTML. This is correct and normal, as there is only 1 pageContext per request - you can only deliver one type of content to the client, and usually that's text/html with links to image/jpeg files. If you change it, that's changed for the whole file being downloaded. Now if you're really still doing this, why then are you using getPageContext instead of using the cfcontent tag, possibly followed by a cfheader? nathan strutz [Blog and Family @ http://www.dopefly.com/] [AZCFUG Manager @ http://www.azcfug.org/] On Tue, Feb 3, 2009 at 12:58 AM, cf coder wrote: > "OutputImage ~| 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:318934 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Calling GetPageContext within a CFC
Can someone please suggest what should I be doing to call the getPageContext method and display the image and the rest of the page from within the CFC? > Hello everybody, > > I have a cfm template which I refer to in the src tag ( src="OutputImage.cfm" border="1" />) . It outputs the image correctly > and as I would expect it to. Here is the code: > > OutputImage.cfm > > > > 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(); > > > 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: > > > > Here is the same code in a cfc. > > > output="true"> > > 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(); > > > > > 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:318921 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Calling GetPageContext within a CFC
Hello everybody, I have a cfm template which I refer to in the src tag () . It outputs the image correctly and as I would expect it to. Here is the code: OutputImage.cfm 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(); 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: Here is the same code in a cfc. 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(); 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:318733 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Calling GetPageContext() within a CFC
Hello everybody, I have a cfm template which I refer to in the src tag () . It outputs the image correctly and as I would expect it to. Here is the code: OutputImage.cfm 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(); 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: Here is the same code in a cfc. 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(); 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:318729 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Calling GetPageContext() within a CFC
Hello everybody, I have a cfm template which I refer to in the src tag () . It outputs the image correctly and as I would expect it to. Here is the code: OutputImage.cfm 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(); 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: Here is the same code in a cfc. 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(); 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