Hi,

I'm developing an application that needs to protect images from directory
snoopers and yet remains relatively easy to maintain.

I've decided to use the CFCONTENT tag in conjuction with the CFHEADER tag in
order to push out images onto a page.

However, the boss has decreed that users should be allowed to save these images,
and have the correct image name and type worked out for them in the dialog box.

I have used the following code for gif files:
     <CFOUTPUT>
          <img 
src="#request.site.cfroot#/teststuff/index.cfm?fuseaction=getcontent&hreflink=#attributes.imgsrc#"
 border="0" alt="" usemap="##map1" ismap>
     </CFOUTPUT>
and this for jpg files:
     <cfoutput>
          <img 
src="#request.site.cfroot#/teststuff/index.cfm?fuseaction=getcontent&hreflink=#attributes.photolink#"
 border="0" alt="">
     </cfoutput>

The teststuff/index.cfm file checks to see what sort of hreflink we have, i.e. a gif 
or a jpg, and then assigns variables.filetype of "image/gif" or
"image/pjpeg"
respectively.  There is also a session variable that is set to the file path (hidden 
from the webserver).

In all, the final code used to push out the image is:
<CFHEADER NAME="content-disposition" VALUE="inline; filename=#variables.filename#">
<cfcontent type="#variables.filetype#" 
file="#request.site.contentpath##session.bams.imgsrc#" deletefile="No" reset="yes">

This is all on one line.  I have checked all of the variables and they are translating 
correctly.

Problem: This works just fine until the user wants to save the image on the calling 
page and we're looking at a jpg file.  If we're looking at a gif file
everything works
OK.  If we're looking at a jpg a right-click on the calling page gives the user the 
option of saving the image as a BMP file, and gives it a filename of
"untitled".

This is not what the boss wants!!

If we copy the url from the image properties into the address bar, i.e. go direct to 
the template doing the cfcontent (in this case teststuff/index.cfm) and
look at that
very same jpg file, the file saves as a jpg with the correct filename.  Weird eh?

Question:  Is there anything that could confuse a header into thinking that it should 
be publishing a jpg file as  a bitmap?

Any clues/help/insights/war stories would be greatly appreciated.

Cheers,

Tania



Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to