Link to home
Start Free TrialLog in
Avatar of 451ls
451ls

asked on

Mozilla browsers don't detect image type for CF templates with jpg or png

This is tricky. Read carefully:

I'm using CFCHART to generate jpg and png images of graphs and pie charts. These images appear on the page correctly but they are not accessible by the user as jpgs or pngs WHEN USING MOZILLA BROWSERS. If you right click on the image, you cannot copy the image. Try the same thing on IE and it works fine.

For other pages of the same app that have static jpg files, the image IS detectable by Mozilla for its correct content-type. The problem for Mozilla is only on the pages where the image is generated by CFCHART.

My guess is that the content-type is set differently when this page is generated by CFCHART and that Mozilla being more by the book is not seeing what it needs to.

Is there a way for me to detect what that content-type setting is for the page?

Here's the CF debug display of some of the related variables - is this a measure of what the server sent to the browser?

CONTENT_TYPE=application/x-www-form-urlencoded
HTTP_ACCEPT=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_ENCODING=gzip,deflate
HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
 JSESSIONID=06303064711095181606332
HTTP_USER_AGENT=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3

On the page that is not generated by CFCHART I notice that the CONTENT_TYPE variable is blank. Is that a clue?

Avatar of mrichmon
mrichmon

please show the cfchart code you are using

Are you writing to a jpg file first?

If so then it should work.

If not then you may be having interference from the area maps that cfchart generates.
Avatar of 451ls

ASKER

Don't know what you mean by writing to a jpg file first. Cfchart creates and embeds
the image in the cfm template.

In the main template I do this:

<cfset imgtype = "png">
<cfset show3d = "yes">

And in one of many cfincludes I have this: (not showing the query that precedes it)

<cfoutput>
      <tr>
        <th colspan="2">#Evaluate(DE(Title))#</th>
      </tr>
      <tr>
      <td class="left">
      <cfset totalminutes = 0>
      <cfset totalcount = 0>
      <cfloop query="GetResults">
      <cfset totalcount = (totalcount + answercount)>
      <cfset totalminutes = (totalminutes + (answer*answercount))>
      </cfloop>
        <table cellspacing="0">
          <tr><td>Average minutes:</td><td>#round(val(totalminutes/totalcount))#</td></tr>
        </table>
      </td>
      <!--- <td><cfloop query="GetResults">#answer# - #answercount#<br></cfloop></td> --->
      <td class="right">
      <cfchart chartheight="150" chartwidth="230" format="#imgtype#"  pieslicestyle="solid" show3d="#show3d#">
         <cfchartseries type="pie" query="GetResults"
         valuecolumn="answercount" itemcolumn="answer">
         </cfchartseries>
      </cfchart>
      </td>
      </tr>
</cfoutput>
There are 2 ways cfchart works.

1) Dispaly directly to the screen

2) Write to a file and then display the image file to the screen

You are using option 1 and with that option if you look at the html you will notice there is also an area map created.  You may want to see what other javascript is created and if that is interfering.
Avatar of 451ls

ASKER

I see the map command in the source for the page, but that is just a bunch of coordinates.

This line comes after the map and could be the problem:

<IMG SRC="/CFIDE/GraphData.cfm?graphID=Images/100001.PNG" id=Images_100001_PNG name=Images_100001_PNG usemap="#Images_100001_PNG_map" border=0>

I think the problem is that this URL is pointing to a .cfm page with the image as part of the query string.
But why is IE able to detect the image and mozilla browsers not?



Avatar of 451ls

ASKER

And regarding your option 2 approach, would that result in all content on the page, image and text, being one image file? That is not acceptable as the requirement is for MS office users to be able to copy and paste the graph image separately.

nick
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It turns out GraphData.cfm is not really a page.

Search your server - it doesn't exist.

It turns out that this is a cold fusion mapping.

Try the above method of writing to a file first and displaying the image - it works more consistently, but you lose the area map.
Avatar of 451ls

ASKER

Awesome.

It took a bit to test it, but it solves the problem. It is as I expected, the GraphData.cfm, while not a file, does get treated by the browser as if it were a file and thus does not allow "Copy image" on the properties. By creating the image file using the name property of CFCHART it creates a REAL image and thus can be copied.

Thanks again.