1

您好,我在 facebook 上分享我的文章和请愿书的图像时遇到问题,它没有显示好的图像,但在 facebook 调试工具中是可以的。问题是当我在 facebook 上发布链接时,它会在正确的图像旁边插入 2 个缩略图,而正确的图像不是第一个。这是一个示例的链接:http: //www.jednej.cz/petition.php?id=1897

这是我的php代码:

<?php

            $id=(isset($_GET['id']))? $_GET['id'] : '';
            $id = PREG_REPLACE("/[^0-9a-zA-Z.-@_]/i", '', $id);

            if($cat>0)
            {
                if($cat==1)
                {
                    $query = "select * from petition where id_petition='$id'";
                    $result = mysql_query($query)
                        or die("query failed: " . mysql_error());
                    while ($row = mysql_fetch_array($result))
                    {
                        $idz= $row['id_petition'];
                        $name=$row['name'];
                        $name1='Petice: '.$name.'';
                        $description=$row['description'];
                        $description=strip_tags($description);
                        $filename=$row['picture'];
                        if($filename!='')
                          $pic='petitions/'.$idz.'/'.$filename.'';
                        else
                            $pic='nopicture.jpg';
                        $description = substr($description, 0, 153);

                    }

                    echo'
                <meta property="og:title" content="',$name1,'" >
                <meta property="og:image" content="http://www.jednej.cz/images/'.$pic.'">

            <meta property="og:description" content="',$description,'">

                    <title>Jednej.cz - Petice: '.$name.'</title>
                    <meta name="description" CONTENT="Petice: '.$name.'-'.$description.'">
            ';
                }



            }
            ?>
4

0 回答 0