电子邮件的动态图像,例如倒计时时钟(根据 gmail 图像缓存)
我正在尝试做的事情:电子邮件正文中的动态倒计时
What I am trying to do: A dynamic countdown clock in the body of an email
是什么让我感到痛苦:谷歌决定为 gmail 客户端的用户缓存图片
What is causing me pain: Google's decision to cache images for users of the gmail client
去年 11 月,我使用这种技术为我的公司实现了一个电子邮件倒计时:
I implemented an email countdown clock for my company last November using this technique:
电子邮件中的倒数计时器图像 GIF
效果很好,但是在 12 月,当 Google 决定为使用 Gmail 客户端的用户缓存所有图片时,他们遇到了麻烦.
Worked like a charm, however in December, a major monkey wrench was thrown by Google when they decided to cache all images for people using Gmail clients.
http://kickdynamic.com/update-on-the-gmail-image-change/
因此,该问题会影响所有在 gmail 客户端上再次打开电子邮件的人.他们将看到一个缓存的图像.对于倒计时之类的东西,这会造成很大的伤害.
So the problem affects all people on gmail clients that open an email a second time. They will see a cached image. For something like a countdown clock, this would cause a lot of harm.
诚然,这有点像一个盲目的求救电话,但有没有人想出一个不受谷歌图像缓存影响的电子邮件倒计时时钟?
Admittedly this is somewhat of a blind distress call, but has anyone figured out how to do a email countdown clock that is unaffected by google's image caching?
推荐答案
我也遇到了同样的问题.因此,使用以下标头,我禁用了图像缓存,它也可以在 Gmail 中使用(因此 Gmail 图像代理尊重缓存标头):
I had the same problem. So with the following headers, I disabled image caching and it works in Gmail too (therefore Gmail Image Proxy respects the cache headers):
header('Content-Type: image/jpeg');
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
此库注释的致谢.
相关文章