I want to display large photos in my Facebook app's feed view immediately. Is it possible to get the large photo src URL from a stream/feed using one API call? The photo id is returned in the stream/feed and one can of course then supply this photo id in an additional FQL or graph API call to retrieve all the information about that photo. However, is there a way using multi-query or batch calls to get a larger photo src url using one API roundtrip?
相关问题
- facebook “could not retrieve data from URL”
- JDK 11. javax.net.ssl.SSLPeerUnverifiedException:
- To Get the Access Token for facebook api
- Access paging in iOS - previous and next : retriev
- I am getting an error when deleting the scheduled
相关文章
- Facebook login for group members
- The method FB.api will stop working when called fr
- Save a photo to custom album in iOS 8
- How to fix 'Facebook has detected MyApp isn
- Extract poll results from Facebook Graph API
- AS3 API: Deleting App Invites
- Please explain FQL profile table pic_crop
- Post a photo to a page for iOS
Use Facebook UserId (Oject ID) to get the picture.
https://graph.facebook.com/173xxxx8635/picture?type=large&redirect=false
which returns JSON data with picture URL.
The answer by @streetlogics works fine but only on pictures that have
{object_id}
.But I also wanted large pictures for the feed's shared links, which sometimes don't have
{object_id}
. I finally realized that the{picture}
thumbnail URL contains the encoded URL for the original site's large image:--> contains -->
So I made a loop that checks for
{object_id}
and if not present then extracts the URL from{picture}
:I haven't tried this with stream/feed photos, but the generally accepted way of doing this is:
If you want the "large" version, you would do:
I'm not 100% sure if this would work for an actual photo (instead of a user profile picture or page profile pic), but I have a hunch it will - the only caveat is that you obviously must have a logged in user that is authorized to view the photo (unless it's public).
A good trick with the new api is to get the pic_cover field from the event table and to process it according to the size you want to use
I found when I was having this trouble that it turned out to be the picture I was downloading rather than the size I was setting it.
If for example I downloaded all my photos with a request of
I am using the dictionary key search "picture" as I want the picture.
This though will get me a lower quality picture than if I searched for "source" in this search:
If you go on the Facebook API explorer and search for photos and then click on the picture and source jpg links you can see the difference in size and quality.
Since changing this method I have managed to get rid of using the type parameters as it doesn't seem to make a different.
Note: I am using iPhone and not iPad or a larger screen so I don't know how this affects bigger screens.
If anybody is looking to this and type large is not enough, I found other solutions.
Type
large
is kind of small anyway (close to 200px). You can get larger image by adding i.e.?width=1000
or?height=1000
. Facebook will return picture closest to given dimension and preserve aspect ratio. When passing both dimenstions like?width=1000&height=1000
, facebook will cut image to given dimensions (in this case square).