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.

Link to comment
Share on other sites

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?)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.