I have a PHP file that displays images that are stored in my database. I'm trying to optimize my website by sending certain headers to the browser that say how long before expiration or when it expires.

I don't want to just use "Cache-Control: max-age" with some time that I estimated the images would expire, because they could either change in 5 months or 1 second from now. But is that the only thing I can do? For each image, I can also get the timestamp of when it was added if that helps at all. What headers would be best to send to the browser?
Jjkdjiw Reviewed by Jjkdjiw on . Dynamic Image Header Optimization I have a PHP file that displays images that are stored in my database. I'm trying to optimize my website by sending certain headers to the browser that say how long before expiration or when it expires. I don't want to just use "Cache-Control: max-age" with some time that I estimated the images would expire, because they could either change in 5 months or 1 second from now. But is that the only thing I can do? For each image, I can also get the timestamp of when it was added if that helps at Rating: 5