2017-10-27 7 views
1

나는 Theta Camera SDK를 사용하여 360 도의 각도로 사진을 찍습니다.페이스 북에 Theta 360 ° 사진을 게시하는 방법

이 사진을 Facebook에 게시하고 싶습니다. 360 사진입니다.

String path= "/storage/emulated/0/path/imagebitmap.jpg"; 

    SharePhoto photo = new SharePhoto.Builder() 

      .setImageUrl(Uri.fromFile(new File(path))) 
      .setCaption("") 
      .build(); 

    SharePhotoContent content = new SharePhotoContent.Builder() 
      .addPhoto(photo) 

      .build(); 
    ShareApi.share(content,shareCallback); 

그것은 성공적으로

enter image description here

저도 같은 문제가 발생 ._er_injected 만에 확장을 변경하고 같은 페이스 북 있지만보기에 게시했습니다.

또한이 코드

Bitmap icon = BitmapFactory.decodeResource(getResources(),R.drawable.imagebitmap); 

    ByteArrayOutputStream stream = new ByteArrayOutputStream(); 
    icon.compress(Bitmap.CompressFormat.PNG, 100, stream); 
    byte[] byteArray = stream.toByteArray(); 

    Bundle params = new Bundle(); 


    /*spherical_metadata*/ 
     String mjson="{\"ProjectionType\": \"equirectangular\",\"CroppedAreaImageWidthPixels\": 240,\"CroppedAreaImageHeightPixels\": 240,\"FullPanoWidthPixels\": 1962,\"FullPanoHeightPixels\": 981,\"CroppedAreaLeftPixels\": 981,\"CroppedAreaTopPixels\": 490}"; 

    params.putByteArray("picture", byteArray); 
    params.putBoolean("allow_spherical_photo", true); 
    params.putString("spherical_metadata", mjson); 
    params.putString("name", "Panorama images"); 




/* make the API call */ 


    new GraphRequest(
      AccessToken.getCurrentAccessToken(), 
      "/me/photos", 
      params, 
      HttpMethod.POST, 
      new GraphRequest.Callback() { 
       public void onCompleted(GraphResponse response) { 
     /* handle the result */ 

        Log.e("@@@response", String.valueOf(response)); 
       // Toast.makeText() 


       } 
      } 
    ).executeAsync(); 

내가 잘못된 방법으로 API를 호출하고 생각을 사용합니다.

답변

0

마지막

따라서 만들어 모두 링크와 변화에서, CroppedAreaImageWidthPixels 등 Read this Link하여 솔루션을 얻었다과 ProjectionType에 대해주의 깊게 읽고 This Facebook reference

에서이 구형에 대한 페이스 북

의 그래프 API 광고

그리고 더 읽기 전화

크기는 (5376 * 2688)가 이미지 너비에 따라 같은 크기가되도록하는 이미지의 같은 크기입니다.

private void sharePhotoToFacebook(){ 

    Bitmap icon = BitmapFactory.decodeResource(getResources(),R.drawable.imagebitmap); 

    ByteArrayOutputStream stream = new ByteArrayOutputStream(); 
    icon.compress(Bitmap.CompressFormat.PNG, 100, stream); 
    byte[] byteArray = stream.toByteArray(); 

    Bundle params = new Bundle(); 


    JSONObject json= new JSONObject(); 
    try { 
    json.put("ProjectionType", "equirectangular"); 
    json.put("CroppedAreaImageWidthPixels", 5376); 
    json.put("CroppedAreaImageHeightPixels", 2688); 
    json.put("FullPanoWidthPixels", 5376); 
    json.put("FullPanoHeightPixels", 2688); 
    json.put("CroppedAreaLeftPixels", 0); 
    json.put("CroppedAreaTopPixels", 0); 

    } catch (JSONException e) { 
    // TODO Auto-generated catch block 
    e.printStackTrace(); 
    } 


    JSONObject jsonObject=new JSONObject(); 
    params.putByteArray("picture", byteArray); 
    params.putBoolean("allow_spherical_photo", true); 
    params.putString("spherical_metadata", json.toString()); 




    new GraphRequest(
     AccessToken.getCurrentAccessToken(), 
     "/me/photos", 
     params, 
     HttpMethod.POST, 
     new GraphRequest.Callback() { 
      public void onCompleted(GraphResponse response) { 
     /* handle the result */ 

       Log.e("@@@response", String.valueOf(response)); 

    Toast.makeText(getApplicationContext(),"Snapshot shared On Facebook",Toast.LENGTH_SHORT).show(); 


      } 
     } 
).executeAsync(); 
}