Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image File Caching Issue

Status
Not open for further replies.

jl8789

MIS
May 22, 2003
293
0
0
US
I am creating a chart and writing it to an image file of type .png. I’ve also wrote it to a .jpg file so that is not the issue I am having. The issue is when I try to show the image that is written to. The image shows up fine, but if you modify data that creates the chart and then come back to this page where the chart and image is displayed, the image does not show the correct information until the page is refreshed. The image is saved with the correct data if I look at the image through explorer, but it seems the page is not grabbing the latest image. I am developing locally in CFMX and I thought I found a solution for this. I created a variable for the image location to be written to, and then displayed from. It works fine. Then when I put the code up to our development server which is on CFMX7 the image displays as an X, not found. I try displaying the image in 3 ways at the end of the code below. The first way doesn’t work and the last two do work, but they don’t ‘refresh’ with the latest image that is actually being saved when coming to this page without refreshing the page or closing the browser and coming back in. Is there a way I can force it to always grab the latest image instead of what is in cache? I am already forcing the page to not be cached in the headers. And\or, why is CFMX7 having an issue with assigning the img src to a variable!?


<cfset thisPath=ExpandPath("../")>
<cfset serverDirectory=GetDirectoryFromPath(thisPath)>
<cfchart format="png" chartheight="150" chartwidth="500" showxgridlines="yes" showygridlines="yes" gridlines="#GL#" seriesplacement="cluster" databackgroundcolor="##DDDDDD" showborder="no" fontsize="10" fontbold="no" fontitalic="no" show3d="yes" xoffset=".01" yoffset=".01" rotated="no" sortxaxis="yes" showlegend="yes" showmarkers="no" pieslicestyle="sliced" scalefrom="0" scaleto="#rangeto#" name="myChart">
<cfchartseries type="bar" query="Appcount1" itemcolumn="app" valuecolumn="ct" serieslabel="Tier 1" Seriescolor="red">
<cfchartseries type="bar" query="Appcount2" itemcolumn="app" valuecolumn="ct" serieslabel="Tier 2" Seriescolor="green">
<cfchartseries type="bar" query="Appcount3" itemcolumn="app" valuecolumn="ct" serieslabel="Tier 3" Seriescolor="blue">
</cfchart>

<!--- Save chart --->
<cfset request.chartImage = "#serverDirectory#IRIS\images\chartImage.png">
<cffile action="WRITE" charset="ISO-8859-1" file="#request.chartImage#" output="#myChart#">

<!--- create the graph for the total count by app --->
<p align="center"><img src="<cfoutput>#request.chartImage#</cfoutput>" alt="" border="0"></p>
<p align="center"><img src="../IRIS/images/chartImage.png" alt="" border="0"></p>
<p align="center"><img src="<cfoutput>#request.images#</cfoutput>chartImage.png" alt="" border="0"></p>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top