I'm trying to get the logged in user's profile picture for a canvas app, but I would like to have it in a specific size.
Is this possible and, if so, how?
Currently I'm using the following:
graph.facebook.com/{user's FB ID}/picture?type=square
This gives me a 50px by 50px image. There are also options to use type=normal and type=large to give large image size, but these are not square images, and also not the exact size I am looking for.
To be specific, is there a way to get a member's profile picture in size 80px by 80px directly from Facebook, without downloading a larger image and downsizing/cropping on my end?
Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.
The Legacy REST API is in the process of being deprecated, while the Graph API is the most current, so if you're unsure of which one to use, your best bet is to go with that one. As you suggested, the Graph API, just like the Legacy REST API, is in fact a RESTful API.
You can use width/height as parameter:
graph.facebook.com/{user's FB ID}/picture?width=100&height=100
Just keep in mind that you may not get exact sizes, but very close ones.
Getting a bigger facebook profile picture via facebook php sdk, this worked for me:
$response = $fb->get('/me?fields=picture.width(400).height(400)', getenv('FACEBOOK_ACCESS_TOKEN'));
in 2019!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With