简体   繁体   English

在Facebook分享器上的自定义图像

[英]Custom image on facebook sharer

I'm working on task of share a link on facebook. 我正在完成在Facebook上共享链接的任务。 But I want to display my own static image (independent of url). 但是我想显示我自己的静态图像(独立于url)。 With help of google and facebook, I come to know that I have to pass image path (which I want to display) in image parameter of sharer.php. 在google和facebook的帮助下,我知道我必须在sharer.php的图像参数中传递图像路径(要显示)。 But still, it displays image related to that site. 但是,它仍然显示与该站点相关的图像。 I don't know that where is my mistake. 我不知道我的错误在哪里。 If anyone know answer then please explain or suggest me link from where I can understand from beginning. 如果有人知道答案,请解释或建议我从一开始就能理解的链接。 Thank You. 谢谢。 Here is my code. 这是我的代码。

<?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>  

Your image http://www.daddydesign.com/ClientsTemp/Tutorials/custom-iframe-share-button/images/thumbnail.jpg is the problem - it's not actually an image but takes you to a regular webpage. 您的图片http://www.daddydesign.com/ClientsTemp/Tutorials/custom-iframe-share-button/images/thumbnail.jpg就是问题所在-它实际上不是图片,但可以带您进入常规网页。

You need to set a specific image which fits facebook's size requirements, the minimum size is 200x200 pixels. 您需要设置适合Facebook尺寸要求的特定图像,最小尺寸为200x200像素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM