943,931 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3160
  • PHP RSS
Apr 4th, 2007
0

new image doesn't load in IE

Expand Post »
Hi,

Will anybody please help me with this.

The bar chart image is created and stored using php code. each time the page is hit, the new image is created and displayed.

The firefox always dispaly the new image but IE always dispaly the old image and I have to refresh inorder to see the new one. may be this is due to cache.

Will anyone please guide me how to overcome this.

Thanks in advance!
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
crazynp is offline Offline
58 posts
since Jan 2007
Apr 4th, 2007
0

Re: new image doesn't load in IE

Change the name of the file each time. That will prevent caching.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Apr 4th, 2007
0

Re: new image doesn't load in IE

Click to Expand / Collapse  Quote originally posted by stymiee ...
Change the name of the file each time. That will prevent caching.
Thanks stymiee !

but do you think this is an efficient solution? The number of files will get increasing and that need to be deleted.

Is it possible to disable the cahing?

Regards!
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
crazynp is offline Offline
58 posts
since Jan 2007
Apr 4th, 2007
0

Re: new image doesn't load in IE

There's no reliable way to disable caching. You can send send out headers to prevent caching but I've found this to not be 100% effective. A better solution might be to use PHP to output the image. Then you can append a timestamp to the filename to make it look unique: <img src="/images/chart.php?1091343214">.

The php code in chart.php would look like this:

php Syntax (Toggle Plain Text)
  1. <?php
  2. header('Content-type: image/gif');
  3. $fn = fopen("./chart.gif", "r");
  4. fpassthru($fn);
  5. ?>
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Apr 5th, 2007
0

Re: new image doesn't load in IE

Quote originally posted by crazynp; ...
Thanks stymiee !

but do you think this is an efficient solution? The number of files will get increasing and that need to be deleted.

Is it possible to disable the cahing?

Regards!

Click to Expand / Collapse  Quote originally posted by stymiee ...
There's no reliable way to disable caching. You can send send out headers to prevent caching but I've found this to not be 100% effective. A better solution might be to use PHP to output the image. Then you can append a timestamp to the filename to make it look unique: <img src="/images/chart.php?1091343214">.

The php code in chart.php would look like this:

php Syntax (Toggle Plain Text)
  1. <?php
  2. header('Content-type: image/gif');
  3. $fn = fopen("./chart.gif", "r");
  4. fpassthru($fn);
  5. ?>
If the PHP generated bar graph image is being saved as a file, then you can also use the method suggested by stymiee with the timestamp directly on the image...

eg:

<img src="/images/chart.jpg?1091343214" />

Even though its a jpg extension it should still bypass most HTTP caches (I have not tested this though). That way you don't have to pass the image data to PHP.
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
Apr 6th, 2007
0

Re: new image doesn't load in IE

Thanks to both of you. I will try to implement this after few days. Once again thank you both for help and suggestion.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
crazynp is offline Offline
58 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP gaming site
Next Thread in PHP Forum Timeline: hosting problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC