AndrewHenderson AndrewHenderson -4 years ago 104
Javascript Question

How can I get a high quality profile picture using React Native Facebook SDK GraphRequest?

I'm trying to get a high resolution picture using the React Native Facebook SDK, however the default image quality is very poor. It's 50x50 and very low resolution.

Request:

new GraphRequest('/135121013672357',
{
parameters: {
fields: {
string: 'picture'
}
}
},
_responseInfoCallback
)


Response

{
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/16864988_145199975997794_4154735936748679550_n.jpg?oh=bb5f32ecb73dd9b8fb8ac45920e2ffc5&oe=593223A8"
}
},
"id": "135121013672357"
}


Looking at Facebook's Graph API docs, there is a parameter, "type", whereby one can request a particular size (small, medium, large). What isn't clear however, is how to format that request.

picture?type=large // Error

picture{type:large} // 200 However, picture is omitted from Response

Answer Source

Try using Graph API field expansion to get the resource:

picture.type(large)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download