php 由于谷歌的图片代理,Gmail 中的图片链接损坏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20491590/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:14:41  来源:igfitidea点击:

Image links broken in Gmail because of google's Image proxy

phpemailgmail

提问by Balaji Kandasamy

Image links in gmail are broken because of google's Image proxy (news1,news2). I can't load my site's images in gmail.

由于谷歌的图像代理(news1news2),gmail 中的图像链接被破坏。我无法在 gmail 中加载我网站的图片。

Actual image path is: http://sampleimageurl.com/images/logo.jpg

实际图片路径为:http: //sampleimageurl.com/images/logo.jpg

But I get the same image path like this in gmail:

但是我在 gmail 中得到了相同的图像路径:

https://ci3.googleusercontent.com/proxy/CUiMBo2ELdin8h5R_jKaarbsjQOZUXM3765smBK1PB4BsKq9EsVziwcOYFqjZqCkRDyu1jzoityEA_PJ=s0-d-e1-ft#http://sampleimageurl.com/images/logo.jpg

https://ci3.googleusercontent.com/proxy/CUiMBo2ELdin8h5R_jKaarbsjQOZUXM3765smBK1PB4BsKq9EsVziwcOYFqjZqCkRDyu1jzoityEA_PJ=s0-d-e1-ft#http://sampleslogo.jpg/

Does anyone knows how to solve this issue?

有谁知道如何解决这个问题?

采纳答案by mrduguo

Because your image wasn't open to public.

因为你的形象没有向公众开放。

You need make sure the new Gmail image proxy can fetch your image from google server.

您需要确保新的 Gmail 图片代理可以从谷歌服务器获取您的图片。

回答by sereda

In Google Apps, it's now possible to disable Image Proxy for GMail (in Apps Settings). Or, better, you can white-list your internal URLs for which image proxying should be disabled.

在 Google Apps 中,现在可以禁用 GMail 的图像代理(在应用设置中)。或者,更好的是,您可以将应禁用图像代理的内部 URL 列入白名单。

回答by Kumar V

DEG's research has confirmed reports from wordtothewiseblogger, Laura Atkins, that “Google is rewriting image links. This rewriting appears to be happening during the delivery process. Older messages that are currently in mailboxes aren't showing this tracking.”

DEG 的研究证实了wordtothewise博主 Laura Atkins 的报道,即“谷歌正在重写图像链接。这种重写似乎发生在交付过程中。当前在邮箱中的旧邮件未显示此跟踪。”

For global images, this means only one user has to open the mail and the images are pulled from the server. In the case of tracking images, every image file name is unique. Every new open will cause Google to grab the uniquely named image. The result is that senders can track the first open, but no subsequent opens.”

对于全局图像,这意味着只有一个用户必须打开邮件,并且图像是从服务器拉取的。在跟踪图像的情况下,每个图像文件名都是唯一的。每次新打开都会导致 Google 抓取唯一命名的图像。结果是发件人可以跟踪第一次打开,但无法跟踪后续打开。”

Reference: http://www.degdigital.com/blog/gmail-tracking-disruption-for-marketers/

参考:http: //www.degdigital.com/blog/gmail-tracking-disruption-for-marketers/

回答by kravits88

Two things that might help:

两件事可能有帮助:

  1. Use traditional image formats like .jpg, .png, .gif (formats like svg do not always work)
  2. Make sure there are no spaces or strange characters in the image path (Check your server request logs. If it gives a 404 to google it is probably a link format issue.)
  1. 使用 .jpg、.png、.gif 等传统图像格式(svg 等格式并不总是有效)
  2. 确保图像路径中没有空格或奇怪的字符(检查您的服务器请求日志。如果它向 google 提供 404,则可能是链接格式问题。)

回答by dimarti

Change the image's location. In the new Google setup, the first time an image is opened, Google downloads the image and caches it on a Google managed proxy.

更改图像的位置。在新的 Google 设置中,首次打开图像时,Google 会下载该图像并将其缓存在 Google 托管代理上。

回答by Yassine Ahram

I had the same issue and I solved the problem hosting the images in my public server (http://mydoamin.com/img/images.jpg).

我遇到了同样的问题,我解决了在我的公共服务器 ( http://mydoamin.com/img/images.jpg) 中托管图像的问题。

Next step responsive email displaying responsive images: CSS

下一步响应式电子邮件显示响应式图像: CSS

@media only screen and (max-device-width: 480px) {
   td.headercell { 
      background-image: url(images/[email protected]) !important;
      background-size: 325px 115px;
      width: 325px !important;
      height: 115px !important;
   }
   td.headercell img {
      display: none;
   }
}