Facebook发布360图片

问题描述 投票:1回答:1

我无法通过Graph API在Facebook上发布360图像。我可以发布一张图片就好了。问题是我用于图像的元数据似乎由于某些原因而无法工作。当我手动上传图像时,它被检测为360图像,但不是以编程方式。有什么我想念的吗?我的spherical_metadata中缺少一个参数或参数错误?

这是我用来在Facebook上发布照片的代码:

function Facebook_Share(textToPost)
{
    var imgURL="http://panorama.2020.net/view/ybcjxd4hugnmeyvaorug/panorama.jpg";
    FB.api('me/photos', 'post', {
        message: textToPost,
        spherical_metadata : { "ProjectionType" : "equirectangular", "CroppedAreaImageWidthPixels" : "1696", "CroppedAreaImageHeightPixels" : "848", "FullPanoWidthPixels" : "4000",
            "FullPanoHeightPixels" : "2000", "CroppedAreaLeftPixels" : "566", "CroppedAreaTopPixels" : "283" },
        url:imgURL        
    },  function(response){

        if (!response || response.error) {
            alert('Error occured');
        } else {
            alert('Post ID: ' + response.id);
            document.getElementById("myTextarea").value = "";
        }
    });
}

PS:网站网址不是我现在用来测试我的脸书图片的网站。我只使用它来检索图像,直到我的功能正常工作。

facebook facebook-graph-api facebook-javascript-sdk panoramas 360-degrees
1个回答
1
投票

OP解决方案。

要在facebook上创建360,请在FB.API调用中添加参数"allow_spherical_photo": true

© www.soinside.com 2019 - 2024. All rights reserved.