【问题标题】:facebook open graph preview thumbnail image is not showing all of a suddenfacebook打开图形预览缩略图图像突然没有显示
【发布时间】:2015-02-26 05:03:02
【问题描述】:

我知道这个问题已经被问过好几次了,但我真的很困惑,因为最近几天我的新链接停止工作了。所有被缓存的旧链接都可以正常工作。

我的元标记非常整洁。 facebook 调试工具不报告任何错误/警告。

这是我的元标记..

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta property="fb:app_id" content="820998487913242">
<meta property="fb:admins" content="param.krish.5">
<meta property="fb:admins" content="obtest.obkrish">
<meta prefix="og: http://ogp.me/ns#" property="og:site_name" content="Salefrog.in">
<meta prefix="og: http://ogp.me/ns#" property="og:type"     content="website">
<meta prefix="og: http://ogp.me/ns#" property="og:url" content="http://www.salefrog.in/register_fmp">
<meta prefix="og: http://ogp.me/ns#" property="og:title" content="Salefrog.in : Register as a Freelance Marketing Partner (FMP)">
<meta prefix="og: http://ogp.me/ns#" property="og:description" content="Register as a FMP. Join us. Get a FMP login and get paid as you earn credit points. More details in your login upon registration.">
<meta property="og:image" content="http://www.salefrog.in/img/fmp-picture.jpg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="250">
<meta property="og:image:height" content="250">
<meta name="title" content="Salefrog.in : Register as a Freelance Marketing Partner (FMP)">
<meta name="description" content="Register as a FMP. Join us. Get a FMP login and get paid as you earn credit points. More details in your login upon registration.">
<link rel="image_src" href="http://www.salefrog.in/img/fmp-picture.jpg">
</head></html>

Facebook 调试工具告诉我它拾取了一张图片,但图片预览根本不存在(看起来被隐藏了),如下所示。

当我点击“og:image”上的“空白”空间时,它会在一个单独的窗口中打开图像,为什么它没有在调试工具中显示预览图像?

我尝试将图片更改为不同尺寸的图片,例如 250x250、更大等,但没有任何帮助。当我将一张旧的缓存图像放在元标记中时,它会显示该图像。这告诉我旧的缓存图像很好,但由于某些原因,新的图像根本没有显示。

我在调试工具中使用链接http://www.salefrog.in/register_fmp 进行了测试。如果你们能发现一些错误,请告诉我,因为它真的可以帮助我节省时间,而不是我自己解决所有问题。

【问题讨论】:

    标签: facebook-opengraph


    【解决方案1】:

    我解决了这个问题。这是由于 .htaccess 阻止(或不让 facebook )解析图像,这是它抛出空白图像的原因,没有显示任何错误。

    我是如何解决或分析整个问题的?

    由于 facebook 调试工具没有报告任何错误,并且在 apache 日志中也没有看到任何错误,我怀疑可能是该工具本身在整个过程中没有检测到任何错误,因此它必须与图像有关本身或介于两者之间的东西。

    来自 facebook 的请求访问了我的网络服务器,该服务器有一个 .htaccess 以重定向到一个单独的 php,该 php 只响应元标记,没有别的。

    由于在 facebook 调试工具或我的网络服务器 httpd 日志中没有报告错误,可能是两件事导致了问题。

    • 图像本身(可能是图像的位置或图像是 损坏或其大小或纵横比或其他格式)
    • facebook 调试工具有错误(可能性很小但不能排除)
    • (.htaccess) 当请求来自 fb 时进行重定向

    因为我对前两项毫无疑问,所以我去了列表中的第三项。

    我怀疑来自 fb 的请求没有获取我的图像,这可能是因为“HTTP GET”也重定向到图像请求。

    解决方案

    我在重定向之前的 .htaccess 中添加了以下行,以便所有图像请求都直接转到该文件,从而解决了整个问题。

     ..
     RewriteCond %{HTTP_USER_AGENT} ^(facebookexternalhit)
     RewriteCond %{REQUEST_FILENAME} !(img|css|jp?g|png|store_images|category_images|fonts|awesome|ttf|tif|custom_images)
     ..
    

    我知道在大多数情况下,这可能与元标记或图像本身的错误有关。但是,就我而言,它不是两者兼而有之。

    希望这可以帮助那里的人!

    【讨论】:

      猜你喜欢
      • 2013-12-14
      • 1970-01-01
      • 1970-01-01
      • 2014-09-26
      • 2012-08-02
      • 1970-01-01
      • 1970-01-01
      • 2012-06-13
      • 1970-01-01
      相关资源
      最近更新 更多