I am having trouble posting a 360 image on Facebook via the Graph API. I can post an image just fine though. The issue is that the meta data I used for the image seems to be not working for some reasons. When I manually upload the image it is detected as a 360 image but not programatically. Is there something I am missing? A parameter missing in my spherical_metadata or a wrong parameter?
Here is the code I use to post a photo on 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: The site url isn't the one i'm using right now to test my facebook image. I only use it to retrieve the image until my feature is working properly.
Solution by OP.
To make it 360 on facebook, add the parameter "allow_spherical_photo": true
in the FB.API call.