动态创建Facebook图像的og标签

时间:2014-04-24 04:24:00

标签: facebook image tags facebook-opengraph

我需要拉出facebook将从数据库中显示的图像

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta property="og:url" content="xxx/public/GigGuide2.asp?A=<%=iActName%>"/>
<meta property="og:type" content="website"/>
<meta property="og:title" content="Live Gig Guide"/>
<meta property="og:image" content="<%=HiRes%>"/>
<meta property="og:site_name" content="MyEpod"/>
<meta property="og:description" content="Live Gig Guide"/>

可以这样做吗?我做错了什么?

开放图形对象调试器显示除了图像标签之外,我的所有标签都是正确的,我需要能够将其行为的照片与其页面等一起使用吗?

1 个答案:

答案 0 :(得分:0)

og:image标记只能使用网址作为内容,请参阅https://developers.facebook.com/docs/opengraph/using-objects/

您需要创建一个单独的脚本,例如

<meta property="og:image" content="xxx/public/ActImage.asp?A=<%=iActName%>"/>

并且ActImage.asp脚本将从数据库中提取图像并设置正确的标题等。由于您没有详细说明图像如何存储在数据库中,这是我能给出的最详细的答案。