共享后Fb.ui feed share对话框裁剪图像

时间:2017-01-05 08:38:20

标签: javascript ajax facebook share fb.ui

**以下是我的代码**我尝试使用fb.ui提要对话框将动态图像从我的网站分享到Facebook。这是我的共享对话框代码。但图像分享后图像被裁剪。我和你分享屏幕,

function share_prompt()
{
    document.getElementById('shareImg').setAttribute("style","height:370px");
var element = $("#shareImg");
        var getCanvas;
     html2canvas(element, {
     onrendered: function (canvas) {

             var base64Image = canvas.toDataURL();

            console.log(base64Image);

            $.ajax({
                url: "save_image.php",
                type:"POST",
                data: {image: base64Image, id: <?php echo $t; ?> },
                success: function(response)
                {
                    $("#shareImg").css({
                            "height": "",

                        });
                      FB.ui(
                           {
                             method: 'feed',
                             name: 'What do you Think For This?',
                             link: 'http://voteit.in/que_detail.php?pid=<?php echo $pid ?>',

                             picture: 'http://voteit.in/poll_result/<?php echo $t ?>.png',
                             caption: 'www.voteit.in',
                             description: 'Your Friends has Already Given There opinions For Above Question. Provide Yours!',
                             author : 'voteit.in',


                             message: ''

                           },
                           function(response) {
                             if (response && response.post_id) {

                             } else {
                              // alert('Post was not published.');
                             }
                           }
                         );

                }
            });
           // $("#previewImage").append(canvas);
            //getCanvas = canvas;

         }

     });

}

In Mac After Sharing Image

0 个答案:

没有答案