7

I am trying to post 360° photos on behalf of my app's users, but I can't figure out how to make it work.

I loaded the Facebook Javascript Graph API, logged the user with "publish_actions" scope and used the following code to post a picture using equirectangular projection:

FB.api(
        "/me/photos",
        "POST",
        {
            "url": "MY_PUBLIC_URL",
            "allow_spherical_photo": true,
            "spherical_metadata": {
                "ProjectionType": "equirectangular",
                "CroppedAreaImageWidthPixels": 240,
                "CroppedAreaImageHeightPixels": 240,
                "FullPanoWidthPixels": 1962,
                "FullPanoHeightPixels": 981,
                "CroppedAreaLeftPixels": 981,
                "CroppedAreaTopPixels": 490
            }
    }, function (response) {
        console.log(response); // I get "{"id":"...", post_id:"..."} so no error
        if (response && !response.error) {
          /* handle the result */
        }
    }
);

It is posting correctly on the current user's timeline, but it is shown as a "normal" picture, not a 360° panorama.

Did someone implement a 360° panorama posting feature that works?

My photo should have the correct ratio (2:1) and is a correct 360° photo.

Thank you in advance for your help.

Quent1V
  • 198
  • 1
  • 8
  • where you pass image? because I also want to do same. – Sweety Jul 12 '17 at 06:03
  • 1
    Hi Sweety, in my example I pass it through the "url" parameter: your photo should be accessible through a public URL. The other method documented here (https://developers.facebook.com/docs/graph-api/photo-uploads) is to pass it in the body of the POST request. – Quent1V Jul 13 '17 at 07:01
  • Do you know how to post 360 degree using php? as you have done using javascript. because when i post 360 image it shows simple image. and i try this parameter allow_spherical_photo": true – Sweety Jul 13 '17 at 11:19
  • As I said in the answer, it is important that the posted images contains the correct metadata. If you succeed in posting a picture but it does not display as 360 panorama, it might be because the metadata is incorrect. – Quent1V Jul 13 '17 at 14:45
  • I used Your ansered code. How add metada to images. Because I convert image into 360 by using onlie EXif software.And When I directly post 360 degree image on facebook. It shows Panoroma image.?Please help me out – Sweety Jul 14 '17 at 04:25
  • Hi Sweety, unfortunately I can't help you more than that: the picture you want to upload through the API should be passed in the URL parameter or in the body. If it has the correct metadata (as described here: https://developers.google.com/streetview/spherical-metadata), it will be displayed correctly. If it is not shown correctly, there's a good chance that the metadata you put is not correct. – Quent1V Jul 16 '17 at 19:47

1 Answers1

4

I finally found a working solution for my issue: only put "allow_spherical_photo": true and remove spherical_metadata.

Then, the 360° pictures need to have metadata on them, in order for the Facebook processing to display them properly (XMP metadata as explained here: https://developers.google.com/streetview/spherical-metadata)

Thanks.

Quent1V
  • 198
  • 1
  • 8