I have a script that is generating an image with PHP on a server, in the form of image.png. I’m then using this image in different places using <img src="http://domain.com/images/image.png" />.
The problem I’m running into is that even though the image is being regenerated every 30 minutes, it seems to be cached and won’t show the new values until I go to http://domain.com/images/image.png and then ctrl+shift+refresh.
Is there any way I can keep the image name the same, but make it always show the newest version of the image?
There are a few options, depending on your situation. If “images/image.png” is an actual file on the server and you are accessing it directly, then you have to change the cache settings on the folder or use .htaccess to inform a browser to resend it.
If you are using PHP to find the image and returning it, you can use PHP to send headers.
To do it perfectly with PHP, you can check if its actually modified