How to get a facebook profile picture under https?
Is it possible to get an facebook profile picture under https using the new Graph API?
We run a site under https, but the profile picture returned by the facebook Graph API is always served as http (when using https://graph.fa开发者_运维技巧cebook.com/XXX/picture, the request is redirects to http:// ...). The result is the dreaded mixed-content message.
Anybody know of a workaround?
Here is the fix: you need to the parameter: return_ssl_resources=true
example:
https://graph.facebook.com/FB_UID/picture?return_ssl_resources=true
Use link 1 to get a high resolution image, link 2 to get an icon sized image where 'xxxx' refer to 'facebook_user_id'.
- link 1 : https://graph.facebook.com/xxxx/picture?type=large
- link 2 : https://graph.facebook.com/xxxx/picture?type=small
The Graph API is essentially a very basic API, it's probably not the most efficient method to grab images. A better alternative is to learn how to uSe "FQL" and create a FQL that grabs all the UID's profile pictures. This way, instead of hundred and hundreds of calls, which can be very slow, you grab all the info you need in one call.
精彩评论