Facebook 分享不显示图像

发布于 2024-11-02 02:14:09 字数 1539 浏览 2 评论 0原文

我编写了一个新闻 PHP 脚本。每条新闻的末尾我都有一个 Facebook 分享按钮。问题是我无法通过 Facebook 共享显示缩略图。

我尝试了 Meta OG

<link rel="image_src" href="" /> 

element 但没有成功。有趣的是,一些使用我的新闻 PHP 脚本的域没有问题,但有些域却有问题。

域名没有任何问题:

有问题的域名:

我也尝试了 addThis 但它没有解决问题。

上述所有域名均使用同一系统。我认为这可能是因为系统的原因,所以我尝试了干净的 HTML 页面:

正如您在上一个示例中看到的,我使用了两种不同类型的共享选项。首先是弹出窗口。我通过 URL 发送了所有参数,但有些域显示图像,有些则不显示。我还添加了 addThis 选项。

我还考虑了 .htaccess 并清理了其中的所有内容,因为我认为 .htaccess 可能会阻止某些内容。我非常仔细地迈出了我能想到的每一步。

这个问题开始很烦人,如果有人能帮助我,我会很高兴。

I code a news PHP script. End of each news I have a Facebook share button. The problem is I can't display thumbnail images with Facebook share.

I tried Meta OG

<link rel="image_src" href="" /> 

element without any success. Interesting thing is, some of the domains which is using my news PHP Script, has no problem with it but some has.

Domain without any problems:

Domains with problems:

I also tried addThis and it didn't solve the problem.

All of the domain names above are using the same system. I thought it might be because of the system so I tried clean HTML page:

As you can see in the last example, I used 2 different kind of sharing options. First with popup. I sent all parameters over URL but some domains display images, some don't. I also added addThis option.

I also thought about .htaccess and cleaned everything in it since I thought .htaccess might block something. I took every step very carefully which I could think of.

This issue started to be annoying, I would be glad if anyone could help me out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

栀梦 2024-11-09 02:14:09

使用 Open Graph 协议

<meta property="og:title" content="The Rock"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
<meta property="og:site_name" content="IMDb"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
      content="A group of U.S. Marines, under command of
               a renegade general, take over Alcatraz and
               threaten San Francisco Bay with biological
               weapons."/>

要测试每个链接,请使用 < a href="http://developers.facebook.com/tools/lint/" rel="noreferrer">URL Linter


看看这个论坛,大​​多数人都会问同样的问题,为什么是OG图片不适用于“喜欢”按钮。也许这是一个错误? 错误 16580

Use Open Graph protocol

<meta property="og:title" content="The Rock"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
<meta property="og:site_name" content="IMDb"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
      content="A group of U.S. Marines, under command of
               a renegade general, take over Alcatraz and
               threaten San Francisco Bay with biological
               weapons."/>

To test each links use URL Linter


Look at this forum, most of them will ask same questions, why OG image is not working on like button. It's a bug maybe? Bug 16580

双手揣兜 2024-11-09 02:14:09

您使用的是公共服务器还是本地服务器?如果 URL 来自本地主机,Facebook 共享不会显示图片。

Are you using a public server or a local one? Facebook share doesn't show pictures if the URLs are coming from localhost.

放赐 2024-11-09 02:14:09

Facebook 似乎想要双向至少 200 像素的图像,无论是在 OG 元数据中提供,还是只是嵌入在页面上。他们最近更新了 URL linter 以显示 OG 元数据的此错误。我现在找不到来源,但我认为以前它们的最大像素尺寸小于 200 像素...

此外,我还发现在 OS X 上的 Chrome 上显示缩略图时出现问题,在 Windows 浏览器上没有问题。真的很奇怪。

Facebook seems to want images that are at least 200px in both directions, whether supplied in the OG metadata, or just embedded on the page. They have updated their URL linter to show this error for the OG metadata recently. I can't find sources now, but I thought they used to have a maximum pixel dimension of less than 200px previously...

Also, I've seen problems displaying thumbnail images for Chrome on OS X, where on Windows browsers there is no problem. Really strange.

对风讲故事 2024-11-09 02:14:09

转到 http://developers.facebook.com/tools/debug 并填写您的网址

如果响应代码503,则您的网站无法访问。可能您的网站正在建设中......

Go to http://developers.facebook.com/tools/debug and fill in your url

If the Responscode is 503 then your website is not accessible. It could be that your website is under construction…

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文