getting high resolution photos that were posted on a page wall/feed

后端 未结 5 977
你的背包
你的背包 2020-12-15 09:58

I\'m getting my page wall with the open graph. And when someone posted a photo, I get it on the JSON

{
     \"id\": \"27888702146_10150369820322147\",
     \         


        
相关标签:
5条回答
  • 2020-12-15 10:10

    You can get different version of the photo by querying Graph API with it's object_id (not photo post_id which is id in results you provided).

    Once you'll request the photo by object id you'll get array of images with URLs and dimensions:

    http://graph.facebook.com/10150369820292147?fields=images
    
    0 讨论(0)
  • 2020-12-15 10:15

    Use this Code. Its Work for me and get Clear Image

    String PICTURE_URL;
    
    String getPicture = hashMap.get("picture");
            if (getPicture.contains("_t.")) {
                PICTURE_URL = getPicture.replaceAll("_t.", "_n.");
            } else if (getPicture.contains("_a.")) {
                PICTURE_URL = getPicture.replaceAll("_a.", "_n.");
            } else if (getPicture.contains("_s.")) {
                PICTURE_URL = getPicture.replaceAll("_s.", "_n.");
            } else if (getPicture.contains("_q.")) {              
                PICTURE_URL = getPicture.replaceAll("_q.", "_n.");
            }
            url=new URL(PICTURE_URL);
            Bitmap bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
            ((ImageView)view.findViewById(R.id.imageView_FullImage)).setImageBitmap(bitmap);
    
    0 讨论(0)
  • 2020-12-15 10:17

    All you need to do is :

    http://graph.facebook.com/me?fields=picture.height(961) 
    // replace 961 with your required height which u want
    
    0 讨论(0)
  • 2020-12-15 10:19

    You can do this from the main posts list now using

    /v2.3/105753476132681/posts?limit=5&fields=likes.summary(true),comments.summary(true), attachments
    

    If attachments doesn't work, try full_picture - but that just gave the 100x100 image for me as well.

    Attachments returns a data hash with a 640x480 version of the image at least (not sure what my orig. photo size was)

    0 讨论(0)
  • 2020-12-15 10:23

    Though requesting a photo by its object_id will return an array of images with different dimensions, in some cases this approach would require an additional call to the Facebook API.

    A simpler approach is to add full_picture to your list of parameters, which will extract the highest resolution image associated with the post.

    /v2.2/6275848869/posts?fields=full_picture
    

    For example, if you want to extract all the posts from a Facebook page in the past X days, with the object_id approach you'd need to call the API 3 times:

    1. To get the page info.
    2. To extract the list of posts and obtain the object_id for each post.
    3. For each object_id, to retrieve the list of higher resolution images.
    0 讨论(0)
提交回复
热议问题