我正在使用添加此内容来分享我的网站www.halisi-kenya.com上的内容,但它发布了错误的图片,任何人都可以提供帮助。其次,我的网址最后显示了有趣的字符http://www.halisi-kenya.com/entry.php?id=55#.UoIPEnD0CyY任何人都可以提供帮助
<?php
include('admin/db_connections/aardb_conn.php');
$query = "SELECT * FROM blog WHERE autoid=".$_GET['id'];
$result = mysql_query($query) or die('Error : ' . mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$title = $row['title'];
$intro = $row['intro'];
$date = $row['timestamp'];
$user = $row['userid'];
$content = $row['body'];
$image1 = $row['image'];
$autoid = $row['autoid'];
$queryi = "SELECT * FROM users WHERE autoid=".$row['userid'];
$resulti = mysql_query($queryi) or die('Error : ' . mysql_error());
$rowi = mysql_fetch_array($resulti, MYSQL_ASSOC);
$fname = $rowi['fname'];
$lname = $rowi['lname'];
$author=$fname." ".$lname;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title><?php echo $title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Halisi Kenya - It's a lifestyle">
<meta name="keywords" content="Halisi kenya,<?php echo $title; ?>">
<meta name="description" content="<?php $Name = strip_tags($content);
echo $Name;?>">
<meta name="author" content="Billy Ochieng">
<meta name="copyright" content="Halisi Kenya">
<meta http-equiv="Reply-to" content="info@halisi-kenya.com">
<!-- Custom Styles Styles -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Raleway:300,500' rel='stylesheet' type='text/css'>
<!-- Support for HTML5 -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Enable media queries on older browsers -->
<!--[if lt IE 9]>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-45485412-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=538741216211393";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="container">
<header id="breadcrumb">
<ul class="breadcrumb breadcrumb-light breadcrumb-divider-middot">
<li><a href="index.php">Home</a></li>
<li><?php echo $title; ?></li>
</ul>
</header>
<aside class="two-col">
<header class="title2 big-title col-sm-12 col-lg-12">
<h2><?php echo $title; ?></h2>
</header>
<article class="blog-wrap content col-sm-12 col-lg-12">
<div class="blogimg">
<img class="media-object" alt="" src="admin/<?php echo $image1; ?>">
</div>
<p><strong class="text-success"><?php echo $intro; ?></strong></p>
<p> <?php echo $content; ?></p>
<div class="post-tags">
<?php echo $date;?>
</div>
<section class="comments">
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_pinterest_pinit" pi:pinit:layout="horizontal"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-508e4b7b0cb342b4"></script>
<!-- AddThis Button END -->
</section>
<div class="post-author">
<h3>By <a href="#"><strong><?php echo $author;?> </strong></a></h3>
<div class="clearfix"></div>
</div>
</article>
<section class="comments">
<div class="fb-comments" data-href="http://www.halisi-kenya.com/entry.php?id=<?php echo $autoid;?>" data-numposts="5" width="600"></div>
</section>
</body>
</html>
答案 0 :(得分:1)
您需要在标题部分定义元og标记。
<meta property="og:image" content="<?php echo "http://halisikenya.com/admin/".$row['image'];?>">
<meta property="og:image" content="http://YOURWEBSITE.com/YOURIMAGE.png">
每张图片的纵横比应为1.91:1,最小600px X 315px或最大1200px X 630px
之后,您需要在FB调试器中调试博客的每个URL。
如果您的网站上有,那么您将在调试器中只看到一个您在og标记中指定的图像。