Facebook Share Dialog不会首先显示缩略图 [英] Facebook Share Dialog does not display thumbnails one first load

查看:137
本文介绍了Facebook Share Dialog不会首先显示缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook共享对话框来共享一个特定的URL。共享链接包含一个应该是以后共享的一部分的图像。这个奇怪的事情是它在移动浏览器上工作得很好。但桌面浏览器首次尝试时不会加载映像。共享窗口的简单重新加载修复了丢失的图像。一旦此图像显示至少一次,它将继续在其他浏览器中工作,无需额外的重新加载。

I'm using the Facebook share dialog to share a specific url. The shared link contains an image which should be part of the sharing later on. The strange thing about this is that it works totally fine on mobile browsers. But desktop browser do not load the image at the first attempt. A simple reload of the sharing window fixes the missing image. Once this image shows up for at least one time it continues working in other browsers without additional reloads..

所以我的问题是:有人知道为什么这个网址不显示图片?

So my question is: Does anybody knows why the first call of this url does not show images?

详细信息

用于打开共享对话框的链接

这是Facebook Debugger的输出,它是免费的的错误,并显示图像。

Here is the output of the Facebook Debugger, which is free of errors and shows the image as well.

Facebook调试器输出

更新

似乎使用Feed对话框没有任何问题。但是这是另一种共享方式,因为它需要一个应用程序ID。

Seems to work with the Feed Dialog without any issues. But this is another way of sharing which I would like to prevent since it requires an App ID.

推荐答案

我终于认为我发现问题。我想要共享的图像由PHP脚本而不是普通文件传递。它似乎与PHP提供图像的方式有关:

I finally I think I found the issue. The images I want to share are delivered by a PHP script instead of a plain file. It seems to be related to the way PHP delivers the images:

不好:

echo readfile($image_thumb_file);

好:

$fp   = fopen($image_thumb_file, "rb");
fpassthru($fp);

完成此更改后,我的图像终于出现在Facebook调试器中。

After doing this change my images finally appear in the Facebook debugger.

这篇关于Facebook Share Dialog不会首先显示缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆