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!

Change the name of the file each time. That will prevent caching.

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!

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
    header('Content-type: image/gif');
    $fn = fopen("./chart.gif", "r");
    fpassthru($fn); 
?>

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!

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
    header('Content-type: image/gif');
    $fn = fopen("./chart.gif", "r");
    fpassthru($fn); 
?>

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.

Thanks to both of you. I will try to implement this after few days. Once again thank you both for help and suggestion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.