[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2004-09-14
8
Medium Priority
?
247 Views
Last Modified: 2013-12-24
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?

0
Comment
Question by:451ls
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 12067953
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.
0
 

Author Comment

by:451ls
ID: 12068772
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>
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12069279
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.
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:451ls
ID: 12069987
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?



0
 

Author Comment

by:451ls
ID: 12070112
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
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 2000 total points
ID: 12070560
no

Just the graph

Here is how you would do that:

<body>
any page content you want here....

<cfchart
                              chartheight="600"
                              chartwidth="750"
                              yaxistitle="Product Count"
                              format="jpg"
                              scalefrom="0"
                              scaleto="300"
                              gridlines="13"
                              name="output_graph">
                              <cfoutput query="PickupTrends" group="PickupDate">
                                    <cfchartseries type="bar" paintstyle="shade" serieslabel="#PickupDate#">
                                          <cfoutput>
                                                <cfchartdata item="#PickupTime#" value="#Quantity#">
                                          </cfoutput>
                                    </cfchartseries>
                              </cfoutput>
                        </cfchart>
                        <cflock name="PickupTrendsGraph" type="exclusive" timeout="10">
                              <cffile
                                    action="write"
                                    charset="ISO-8859-1"
                                    file="#ExpandPath('/images/graphs/PickupTrendsGraph.jpg')#"
                                    output="#output_graph#"
                                    addnewline="yes">
                        </cflock>
                        <cfoutput><img src="/images/graphs/PickupTrendsGraph.jpg" height="600" width="750"></cfoutput>

any more content you want after the graph here....

</body>
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12070568
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.
0
 

Author Comment

by:451ls
ID: 12079399
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.
 
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question