I hope it could be helpful
I am doing similar stuff like you. I can update a new image and display it properly.
I stored the image as binary into the database.
I used
header("Expires: Mon, 26 Jul 1998 05:00:00 GMT");
header("Cache-Control: no cache, must-revalidate");
header("Pragma: no-cache");
<img src='getimage.php?id=$number'>
getimage.php is getting image from the database.