Display Facebook Image Source by ID

I am developing a Facebook application that stores a photo [id] in MySQL. I use the Facebook API to retrieve all the user's photos, and using the switch, the selected photo [id] is stored in mysql.

The problem is how to display the image source using the saved identifier?

+6
source share
1 answer

You check the Graph object for this id,

graph.facebook.com/photoID 

For example, a photo from facebook.com/facebook

 http://graph.facebook.com/427100966728 

This will return a JSON response for which you can select the desired source size.

See http://developers.facebook.com/docs/reference/api/photo/ for more details.

For example, in the PHP SDK

 $a_photo = $facebook->api('/427100966728'); <img src=<?php echo $a_photo['picture'] ?> /> 
+3
source

Source: https://habr.com/ru/post/916383/


All Articles