Jump to content

IE refreshing of images that don't exist


gsaldutti

Recommended Posts

I haven't looked through all your code, but why not simply check if the image exists, before displaying it?

 

<?php
$path = "http://localhost/pas/upload/$file1name";
if (file_exists($path)) {
   echo '<img src="', $path, '" alt="" />;
} else {
   //image doesn't exist
}
?>

 

You'll maybe need to run clearstatcache() before checking.

 

Or simply don't display the image HTML tag when, when a user have chosen to delete the image? Then it can't show up no matter if it exists or not.

That is a definitely a good idea for my code, thanks. But in IE, it's still happening where I remove IMAGE-A and add IMAGE-B and it still displays IMAGE-A.  Mindboggling.

 

I assume clearstatcache() just needs to be at the top of the page one, but I tried it in seveal places throughout the code.

 

Dropfaith mentioned that it could just be a funny thing that is happening on my local machine and once I upload the site to a public server it might work fine. 

 

If you think that is possibility, can someone help tell me how to get the GD library installed/enabled on a server so I can test this on my "live" site (or is that something my hosting company has to do?)

But in IE, it's still happening where I remove IMAGE-A and add IMAGE-B and it still displays IMAGE-A.  Mindboggling.

 

That would only happen when the filenames of the images are identical, right? Naming them differently should stop IE from showing the cached image A.

 

If the live server is not your own, you should ask your hosting company politely about adding GD lib.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.