Explicitly non-cacheable dynamic images issue

Hello everyone,

I’m posting because I have an issue with browser side caching of my dynamic images. I first noticed this through Chrome’s developer tools auditing system. All my content came out as “explicitly non-cacheable”. Which isn’t much of an issue apart from the images which shouldn’t change all that often. Any attempt at setting the headers up miserably fail though. I’m not sure how to go about checking my headers on the client side, or what could be going wrong.

Here’s what I’ve got:




		header("Cache-Control: maxage=360000");

		header('Content-Type: image/png');

		echo $imageblob; //echoing an imagemagick imageblob

		die;




This however does not change the fact the image is still coming out explicitly non-cacheable. Is there an Yii layer I’m unaware of that may interfere here? I’ve tried many variations with the full list of related headers but I kept it simple here with Cache-Control only.

Thanks in advance for your help.

I did not work with this until now… from your code example is not seen… but do you give your images some kind of name as I think that the browser needs the picture name so he can store and retrieve the image cache

The url to retrieve this image would be http://www.site.com/image/preview/15 (bogus example). With 15 being the image id. So if I understand your comment correctly would this mean the browser needs the full name or at very least extension to work with? Or are we talking about some image tag within the blob?

Thanks for your help.