简体   繁体   English

分享此API Facebook分享图片未显示

[英]Share This API Facebook Share Image not showing

I have the trio button social media share using Share This API. 我使用“共享此API”来共享社交按钮。 Everything is ok. 一切都好。 They are all sharing right contents. 他们都共享正确的内容。 But except for the facebook share image, it cannot be registered as part of the og properties. 但是,除了facebook共享图像外,不能将其注册为og属性的一部分。 No image is shown when the facebook popup share shows up. 显示facebook弹出共享时,没有图像显示。 Can someone help please? 有人可以帮忙吗? Thanks in advance! 提前致谢!

I actually just followed the template given by client and I dont want to change API/plugin as much as possible. 实际上,我只是遵循了客户端提供的模板,并且我不想尽可能地更改API /插件。 And I cant find any documentation of this kind of service in the API's site http://developer.sharethis.com/ . 而且我在API的站点http://developer.sharethis.com/中找不到任何有关此类服务的文档。

This is the code. 这是代码。

    <script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=71dfd17f-04ad-4bd7-acfc-7a47e609cc6f&amp;type=website&amp;post_services=email%2Cfacebook%2Ctwitter&amp;button=false"></script>
    <script type="text/javascript">
         var BASE_URL = "http://mydemosite.com/";
         var shared_object1 = SHARETHIS.addEntry({
             title:"My Site | This is showing in fb debugger",
             url: BASE_URL,
             summary:'My summary. This is showing in fb debugger.',
             content:'My Content. This is showing in fb debugger.',
             image: BASE_URL + 'share.png'
         });
         console.log(BASE_URL + 'share.png'); //This returns exactly the url of the image
         shared_object1.attachChicklet("email", document.getElementById("share_email"));
         shared_object1.attachChicklet("facebook", document.getElementById("share_fb"));
         shared_object1.attachChicklet("twitter", document.getElementById("share_twitter"));
    </script>

I also checked in facebook's debugger. 我还签入了Facebook的调试器。 No image was listed under og: properties. og:属性下未列出任何图像。 https://developers.facebook.com/tools/debug https://developers.facebook.com/tools/debug

现在,当我也在<head>标记中进行硬编码时,它也可以工作:

<meta property="og:image" content="<?php echo $base_url; ?>share.png"/>

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

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