如何通过FB.ui显示全宽图像?

时间:2017-01-25 12:22:27

标签: facebook facebook-graph-api facebook-javascript-sdk facebook-php-sdk

我正在使用FB.ui()分享帖子。我的图像大小1200x600。一切都在完美地期待图像维度。它以缩略图显示,但我的图像尺寸为1200X600,因此根据Facebook规则,如果尺寸为1200X600,我的帖子共享图像应该以全宽显示。

以下是我的HTML代码:

<div class='col-md-12 text-center' style='padding:5px 45px'>
    <input type='hidden' value='".$eventName."' id='fb_title' />
    <input type='hidden' value='".$base_url."/images/".$fb_image."' id='fb_image'>
    <input type='hidden' value='".$fb_description."' id='fb_desc' />
    <input type='hidden' value='".$base_url."/events/".$eventUrl."' id='fb_link'>
    <button class='btn btn-primary font_family' id='shareBtn'><i class='fa fa-facebook'></i>&nbsp;Share on facebook</button>
</div>

以下是我的剧本:

<script>
$(document).ready(function(){
$('#shareBtn').click(function(){
    var fb_title = $('#fb_title').val();
    var fb_image = $('#fb_image').val();
    var fb_desc = $('#fb_desc').val();
    var fb_link = $('#fb_link').val();

    FB.ui({
            method: 'feed',
            name: fb_title,
            link: fb_link,
            picture: fb_image,
            description: fb_desc
        });
});
});
</script>

enter image description here

0 个答案:

没有答案