How to Make Image which Can’t Be Cached by Browser

Images as static content on website are usually be cached by browser. Using PHP we can make the image can’t be cached and always loaded from server by putting random number behind the image file.

echo '<img src="photo.jpg?'.time().'" />';

The HTML output will be:

<img src="photo.jpg?1331835943" />

The number 1331835943 is generated dynamically by PHP that forces the browser to always load image from server.



  • mrtg config maker

Leave a Reply

Your email address will not be published. Required fields are marked *