vBulletin Facebook LIKEs thumbnail



我正在运行vBulletin 4.1.5,我已经配置了它的Facebook设置。我面临的问题是,当有人点击LIKE按钮,在Facebook上张贴的缩略图不是线程中的第一个图像,它会从页面的任何地方随机挑选,即在该线程中回复的任何用户的头像!

谢谢你的帮助!

一个解决方案是你可以为所有的共享定义一个全局的"facebook缩略图"

  1. AdminCP
  2. 置>项><<li> Facebook选项/gh>
  3. 图像URL

这个图像应该是你的网站标志或其他东西

我仍然用vB3.8编程。x,但我正在为facebook喜欢的插件工作。可能会帮助你编写你自己的vB4.x

首先,你需要定义opengraph和facebook的名称空间:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"> 
<head profile="http://gmpg.org/xfn/11"> 
第二,你需要facebook的javascript:
<scr ipt type="text/javascript" src="http://connect.facebook.net/en_US/all.js#xfbml=1">
</scr ipt> 

最后,您需要打开在html页面的部分中定义的图形标记:

<meta property="og:type" content="article" /> 
<meta property="og:title" content="this shows up as article's title when you like" /> 
<link rel="image_src" href="http://www.yoursite.com/yoursite1.jpg" /> 
<meta property="og:image" content="http://www.yoursite.com/yoursite1.jpg" /> 
<link rel="image_src" href="http://www.yoursite.com/yoursite2.jpg" /> 
<meta property="og:image" content="http://www.yoursite.com/yoursite2.jpg" /> 
<link rel="image_src" href="http://www.yoursite.com/yoursite3.jpg" /> 
<meta property="og:image" content="http://www.yoursite.com/yoursite3.jpg" /> 
<link rel="image_src" href="http://www.yoursite.com/yoursite4.jpg" /> 
<meta property="og:image" content="http://www.yoursite.com/yoursite4.jpg" /> 

我正在工作的插件将循环通过前5个附件的帖子,并写出image_src标签和og:image标签。我还不确定要用哪个钩子

伪代码:

    $attachs = $db->query_read_slave("
            SELECT attachmentid, attachment.dateline 
            FROM " . TABLE_PREFIX . "post AS post
            INNER JOIN " . TABLE_PREFIX . "attachment AS attachment ON (attachment.postid=post.postid AND attachment.visible=1)
            WHERE threadid = $threadinfo[threadid]
                    AND post.visible = 1
            ORDER BY filename DESC
            LIMIT 5
    ");
    if ($db->num_rows($attachs))
    {
            while ($attachment = $db->fetch_array($attachs))
            {
                    $strImages = "<meta property="og:image"  content="/attachment.php?attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" />"
            }
    }

仅供参考- facebook似乎以相反的方式添加缩略图。他们会看最后一张图片,并把它作为第一个缩略图;显示的下一个缩略图将是倒数第二个,依此类推。如果SQL的排序顺序很重要的话,可能会想要尝试一下。此外,image_src链接用于非开放图形社交网站(google +, twitter)

最新更新