Facebook Sharer not showing image thumbnail

半世苍凉 提交于 2019-12-18 07:13:23

问题


I have followed an example of Facebook share by using URL and parameters

Original (working)

Fiddle >> http://jsfiddle.net/dYfwK/

<a href="http://www.facebook.com/sharer.php?s= 100&amp;p[title]=Title here&amp;p[url]=http://example.com&amp;p[images][0]=http://upload.wikimedia.org/wikipedia/commons/5/55/Kaasmarkt2_close.jpg&amp;p[summary]=I love cheese" target="_blank">Test</a>

Modified (image not appearing)

Fiddle >> http://jsfiddle.net/dYfwK/6/

<a href="http://www.facebook.com/sharer.php?s= 100&amp;p[title]=Title here&amp;p[url]=http://example.com&amp;p[images]
    [0]=http://www.ucmas.com/wp-content/uploads/2013/07/rm.jpg&amp;p[summary]=I love cheese" target="_blank">Test</a>

I've been facing this issue for sometime, eventually I believe this issue is due to the image. Is it the size or something else that caused this ?


回答1:


When I do this it works:

<a href="https://www.facebook.com/sharer.php?s=100&p[title]=Title+here&p[url]=http://example.com&p[summary]=I+love+cheese&p[images][0]=http://www.ucmas.com/wp-content/uploads/2013/07/rm.jpg" target="_blank">Test</a>

What you need to do is remove &amp; from the url and replace it with real &. I then url encoded everything that wasnt a link. this just means replace spaces with +. I also put image at the end of the url. Not sure why but that seemed to do the trick.



来源:https://stackoverflow.com/questions/17920726/facebook-sharer-not-showing-image-thumbnail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!