Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display Facebook image source by id

I am developing a Facebook application that stores into MySQL the photo[id]. I am using Facebook's Graph API to retrieve all of the user's photos and by a radio button the selected photo[id] is stored into mysql.

The problem is, how should I display the image's source by the id stored?

like image 928
cch Avatar asked May 22 '12 18:05

cch


1 Answers

You inspect the Graph Object for that 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 choose the size you desire for the source.

For more information see, http://developers.facebook.com/docs/reference/api/photo/

For example in the PHP SDK

$a_photo = $facebook->api('/427100966728');

<img src=<?php echo $a_photo['picture'] ?> />
like image 143
phwd Avatar answered Sep 30 '22 17:09

phwd