How can I get facebook photo with selection view user set (if they use large image). If I use type = "large" or "normal" or "small" in path graph then I get image but It's not square and It's not selection view of user set. So, how can I get photo with square type and it's view of user set
-
For `picture` nothing gets 100x100 square, only a tiny 50x50... `https://developers.facebook.com/docs/graph-api/reference/v2.0/user/picture` some images are not square and will be returned so. – vsync Jun 18 '14 at 19:21
5 Answers
You can get a square picture of higher dimensions than the normal one for type=square
(which will be only 50x50 pixels in size) by requesting a picture with width
and height
parameters set.
See https://developers.facebook.com/docs/reference/api/user/, “picture” connection, quote:
“Additionally, you can specify width and height URL parameters to request a picture of a specific size. This will return an available profile picture closest to the requested size and requested aspect ratio. […] if width=height, we will always return a square picture.”
Example:
https://graph.facebook.com/4/picture?type=square – Mr Zuckerberg’s “normal” square profile pic, size 50x50
https://graph.facebook.com/4/picture?width=100&height=100 – 100x100 pixels, perfect match for requested size
https://graph.facebook.com/4/picture?width=150&height=150 – asking for 150x150, getting 156x156 instead.
If you can live with maybe sometimes getting images that might be a little bigger (or smaller) then the requested size, you should be fine.
Otherwise it’ll take some testing to try and figure out if there are certain square image sizes that Facebook will always have “in stock” and deliver exact matches for, or if it might differ for every user depending on the picture they uploaded.
-
If avatar is the large picture and user move picture to set image in view port , It get wrong file (image return which doesn't size I want or sometimes It isn't image in view port of user set). How can I handle this case? – Huy Tran Aug 10 '12 at 12:21
-
1@HuyTran https://graph.facebook.com/zuck/picture?type=square **does** return a square image in the view port of the user set. – borisdiakur Aug 10 '12 at 13:48
-
2@Lego: with that path I can get image in view port and It's just size 50x50. But I want size 100x100, with user who upload large image and doesn't move image (in edit thumbnail) --> result of path `graph.facebook.com/zuck/picture?width=100&height=100` will get exactly image with size I want, in case that user move image --> result of image has size 50x50. I don't know what's happening? – Huy Tran Aug 11 '12 at 11:28
-
When I trying by using object id it redirect into , https://fbstatic-a.akamaihd.net/rsrc.php/v1/y5/r/npmTejrANDz.jpg – Vineesh TP Oct 13 '14 at 10:24
-
You guys can also do something like this me/?fields=id,name,birthday,picture.width(200).height(200) ..... much better than having a request for the fields and another one just for the picture – Pablo Fallas Nov 18 '15 at 14:18
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{ @"fields" : @"id,name,picture.width(100).height(100)"}]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
}
instead of 100 you can put 200 ,300 encrypt the response and get it with key

- 29,083
- 12
- 64
- 76

- 579
- 5
- 17
-
-
Can you please check this post and help me http://stackoverflow.com/questions/37135893/high-resolution-images-from-facebook – Jecky May 16 '16 at 07:28
Try using the type square
. As follows:
http://graph.facebook.com/[user_id]/picture?type=square
The square size is limited to 50x50. If you want a large size, you will have to enlarge the square version or crop the large version.
If you don't mind retrieving and cropping an image yourself, follow my tutorial here for code to do exactly that. It will let you generate square images larger than 50px.

- 15,087
- 3
- 41
- 60
This worked for me. Check the following query,
NSString * graphPath = [NSString stringWithFormat:@"%@?fields=photos.fields(id,link,source)", albumID];

- 1,382
- 15
- 22
Get the photo by querying for the user's profile data using FQL. In your case you shouldn't need any access token. There is a column called pic_crop
which is an object that contains the uri you need:
The URL to the largest-sized square profile picture for the object being queried.
width
,height
: the pixel dimensions of this picture.left
,top
,right
,bottom
: the pixel co-ordinates of the user selected crop for this profile picture.
Use the Graph API Explorer for testing your query.
Update: From the Facebook Query Language (FQL) Reference:
Version 2.0 of the Facebook Platform API is the last version where FQL will be available. Versions after 2.0 will not support FQL. Please migrate your applications to use Graph API instead of FQL. Please see our changelog for current version information.

- 10,387
- 7
- 68
- 100