The main issue with cfcontent is that is loads the file into memory and
then serves it. I would suggest writing a servlet that is able to stream
the file out to the buffer.

Matt Liotta
President & CEO
Montara Software, Inc.
http://www.montarasoftware.com/
888-408-0900 x901

> -----Original Message-----
> From: Dave Watts [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 21, 2002 12:34 PM
> To: CF-Talk
> Subject: RE: img!
> 
> > If I wanted to do something along the lines of:
> >
> > joe.cfm?img=/images/go.jpg
> >
> > and have joe.cfm turn into the actual image how would i
> > accomplish such a task?  i'm interested in keeping from
> > being able to look at photos unless they are logged in
> > and i want cfm to manage the logging in via session vars.
> >
> > the images directory would not be web accessible obviously
> > but the .cfm page would call the images from that dir.
> >
> > how can i make the browser think that
> > joe.cfm?img=/images/go.jpg is an actual jpeg and not a
> > cfm file with a jpeg in it?
> 
> You'd need your CFM file to use CFCONTENT to return a JPEG, and not
return
> anything else (no HTML tags or other text output).
> 
> <!--- joe.cfm --->
> <cfif IsUserInRole("PictureViewer")>
>       <cfset ImageToShow = "go.jpg">
> <cfelse>
>       <cfset ImageToShow = "blank.jpg">
> </cfif>
> 
> <cfcontent type="image/jpeg" file="#ImageToShow#">
> 
> > how server intensive is this task?
> 
> Unfortunately, it's pretty intensive, and I wouldn't recommend it in a
> high-usage environment. There are alternatives, such as the use of
> symlinks
> or junctions, or the use of web server authentication, that you can
use to
> offload this kind of thing from CF, if you're in that sort of
environment.
> 
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to