homepage Welcome to WebmasterWorld Guest from 54.161.175.231
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
image caching in firefox
joopdehoop




msg:1276782
 10:20 am on Jan 15, 2006 (gmt 0)

I have been trying to create a slideshow of random pictures on my website. It has been quite succesful (it works perfectly in IE) but Firefox refuses to cooperate... It seems to have something to do with the way Firefox caches pictures, but I'm not sure.

There is a html file, which puts rotate.php as a picture on the page.

There is a javascript file, which puts a new rotate.php in the image frame every four seconds.

There is a PHP file, rotate.php, which randomly outputs a picture.

I'm not sure I'm posting this on the right forum, since PHP, HTTP headers and javascript are involved and I don't know what part is causing the problem.

I'll post a part of rotate.php below..

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
thumb($filename, 170, 170); // thumb is a working thumbnailgenerator, it outputs correctly in both browsers)

[edited by: jatar_k at 5:19 pm (utc) on Jan. 15, 2006]
[edit reason] no urls thanks [/edit]

 

joopdehoop




msg:1276783
 10:30 am on Jan 15, 2006 (gmt 0)

It seems to be working SOMETIMES though.. Weird.

py9jmas




msg:1276784
 10:47 am on Jan 15, 2006 (gmt 0)

In Firefox, right click on the image and select 'View image'. Now, in the white area around the image, right click and select 'View page info'. You should see what Firefox thinks of the expired and modified dates. Are they what you expect?

joopdehoop




msg:1276785
 11:35 am on Jan 15, 2006 (gmt 0)

Thanks for the advice. Funny thing is, when I click "View Image" it *does* load *another* picture. And it says:

Cache source: Memory cache.

I'm not sure what that means. Anyone?

LeChuck




msg:1276786
 5:58 pm on Jan 15, 2006 (gmt 0)

Firefox has two caching options: Memory and disk.

The memory cache includes (correct me if I'm wrong) elements from recently opened pages, such as the images from webmasterworld.com for me now.

The disk cache keeps everything that isn't in the memory cache until it expires.

One solution for you would be to have rotate.php show an img src=$random_image.jpg tag instead of outputting the image directly.

joopdehoop




msg:1276787
 12:33 am on Jan 17, 2006 (gmt 0)

Well there should be a way to prevent FF to put my rotate.php output in its memory cache, right?

Apparantly my header as it is now, doesn't do it. (view code in first message)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved