I have a listing of items, that also contains an image thumbnail. Sometimes I need to change the thumbnail image, but keep the filename the same. Is there a way to force the browser to download the newly uploaded image, instead of grabbing one from the browser cache?
This is very pertinent when people update their avatars, which causes confusion for some users, who keep seeing their old avatar, until they clear the browser cache, or restart the browser.
Append a unique number to the end of the image src
ie
<?php
echo "<img src=../thumbnail.jpg?" . time() . ">";
do this only on the form for the updating avatar
works for me
btw, this works well for forcing updates of other static files
i.e. html for css files is
<link rel="Stylesheet" href="../css/cssfile.css?<?= md5_file('cssfile.css'); ?>" />