PHP and image caching problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
winxp.tar.gz
Forum Newbie
Posts: 3
Joined: Wed Jun 18, 2008 2:06 am

PHP and image caching problem

Post by winxp.tar.gz »

hello,

this might seem to be a pretty noobish issue

I'm an author of a web comic. I set up a small system, but I've noticed something really annoying.

my comic website consists of a single php file (index.php), a text file containing comic images filenames (siema), a css file and a few images.
index.php gets a number of a picture to display via $_GET['show'], then reads 'siema', gets a filename and afterwards:

Code: Select all

 
echo '<img id="siemaimg" src="'.$show.'" />';
 
$show contains already-prepared filename

well, it's working, but each time you view a comic episode, you can notice the the first one appears before the right one loads. it makes a 'blink' effect, which is really unwanted.

i guess that's some kind of a caching problem.

url: http://siemacotam.com/

how to get rid of it?

regards,

winxp.tar.gz
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: PHP and image caching problem

Post by jayshields »

Your website is just a frame containing this website http://kaziordesign.pdg.pl/siemacotam/

Anyway, to the point, it does seem pretty weird. It doesn't do it after the browser has initially cached the images though. So I think it's to do with the old image being displayed until the new one has been downloaded. You could probably solve that with some JavaScript which would do something like download the image before displaying (any of) the page, or even something like Facebook does, where it downloads upcoming images in albums before the user has even got to them.

If the code is as you say it is, the above advice is all I can think of.
winxp.tar.gz
Forum Newbie
Posts: 3
Joined: Wed Jun 18, 2008 2:06 am

Re: PHP and image caching problem

Post by winxp.tar.gz »

thanks for your reply :)
solved it...

it's the most stupid thing that has ever happened to me :O but I've got a bad day today ;/
it was all about a background image of the main div. I exported it from Photoshop. I had an extra layer with the first image, just to set up the layout properly. last time I exported it, I forgot to make that image invisible, so the background simply contained it O_o......

sorry for bothering you... shame on me :P

and I was just to too lazy to make it all JavaScript.
Post Reply