简体   繁体   中英

Facebook Profile Picture Large

I am having trouble trying to request the large version of the users profile picture on Facebook.. in my graph path I'm doing:

NSString *requestPath = @"me/?fields=first_name,last_name,gender,email,birthday,verified,picture";

The picture field in there only gives me the small version of the profile picture, but i need the large and the normal version.. i already tried changing picture to picture_large, pic_large, image_large but none of this works..

Please, i already read the documentations, so don't bother answering if you plan on telling me to read it again.. I'm asking this here because i already searched everywhere and couldn't find a solution.

Thanks, Newton

The short answer you are looking for is picture.type(large)

I was looking for the same thing and found the answer using Facebook Graph API explorer found here .

Now if I use the following code:

[FBRequestConnection startWithGraphPath:@"me"
                             parameters:[NSDictionary dictionaryWithObject:@"picture.type(large),id,email,name,username"
                                                                    forKey:@"fields"]
                             HTTPMethod:@"GET"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error){[self fbRequestCompleted:result];}];

the "picture" key in the "result" dictionary has the value of the large picture's URL.

You can just use:

http://graph.facebook.com/USER/picture?type=large

Where USER can be either the user id or the user name.

That returns a redirect to the static image url, as written in the User object documentation :

HTTP 302 redirect to URL of the user's profile picture (use ?type=square | small | normal | large to request a different photo).

Nitzan Tomer's response is still correct for iOS; if you want to get the large version of the user's profile picture using Facebook's iOS API, you can just write:

    [facebook requestWithGraphPath:@"me/picture" andParams:[NSMutableDictionary dictionaryWithObject:@"large" forKey:@"type"] andDelegate:self];

And you will get the image data in the result object, in this delegate method:

- (void)request:(FBRequest*)request didLoad:(id)result

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM