自定义图像上的facebook共享

Custom image on facebook sharer

本文关键字:facebook 共享 图像 自定义      更新时间:2023-09-26

我正在完成在facebook上分享链接的任务。但我想显示我自己的静态图像(独立于url)。在google和facebook的帮助下,我知道我必须在share .php的图像参数中传递图像路径(我想要显示的)。但是,它仍然显示与该网站相关的图像。我不知道我错在哪里。如果有人知道答案,请解释或建议我链接从哪里我可以理解从一开始。谢谢你!这是我的代码。

<?php
        $title = urlencode("How to Create a Custom Facebook Share Button with a Custom Counter");
        $url = urlencode("http://www.daddydesign.com/wordpress/how-to-create-a-custom-facebook-share-button-with-a-custom-counter/");
        $summary = urlencode("Learn how to create a custom Facebook 'Share' button, complete with a custom counter, for your website!");
        $image = urlencode("http://www.daddydesign.com/ClientsTemp/Tutorials/custom-iframe-share-button/images/thumbnail.jpg");
?>
<html>
        <a id="button" onClick="window.open('http://www.facebook.com/sharer.php?s=100&amp;p[title]=<?php echo $title; ?>&amp;p[summary]=<?php echo $summary; ?>&amp;p[url]=<?php echo $url; ?>&amp;&p[images][0]=<?php echo $image; ?>', 'sharer', 'toolbar=0,status=0,width=550,height=400');" target="_parent" href="javascript: void(0)">
            Click to Share 
        </a>
</html>  

你的图像http://www.daddydesign.com/ClientsTemp/Tutorials/custom-iframe-share-button/images/thumbnail.jpg是问题-它实际上不是一个图像,但带你到一个常规的网页。

你需要设置一个特定的图像,符合facebook的尺寸要求,最小尺寸是200x200像素。