Whenever a user uploads a new image, and the image name remains the same (since the image name is based on the file extension and userid value) chrome doesnt update the cache, and the image appears to stay the same.
for example, a user will upload the file image.png
the server will analyze the file and store it as
87.png
however, the previous file image2000.png was also stored as
87.png
even though they are different files.
Now, the img call is
<img src="/images/87.png">
for both separate images, but chrome doesnt realize they are changed, so it outputs the cached image 87.png instead of loading the new image in the server which was just updated.
is there a way to force chrome (and other browsers) to realize that this image was just updated, and to load the image from the server instead of the cache? or does the image need to have a new name for it to realize?
Sorry my bad, I didnot read the question properly.
This behaviour is because of the expires header of the response from your server. After updating the image, set headers for that image to be expired. So the browser gets the updated image.
How to specifically set the headers to updatd image?
put a column called updated in the database. So everytime you update an image set this column to 1.
set appropriate headers