开发者

How can I integrate Facebook photo album into website? [duplicate]

This question already has an answer here: Closed 10 开发者_运维百科years ago.

Possible Duplicate:

Facebook Api - how to access my photo album

How can I display photos from a Facebook album inside a website?


You can use the graph api to get the images in an album, like this: https://graph.facebook.com/ALBUM_ID/photos You get an array containing all the images in that album. The array contains objects like this:

"name": "hopes you're having a great weekend!",
         "picture": "http://photos-d.ak.fbcdn.net/hphotos-ak-snc1/5370_127826373305_40796308305_2373079_2781005_s.jpg",
         "source": "http://a4.sphotos.ak.fbcdn.net/hphotos-ak-snc1/5370_127826373305_40796308305_2373079_2781005_n.jpg",
         "height": 604,
         "width": 427,
         "images": [
            {
               "height": 604,
               "width": 427,
               "source": "http://a4.sphotos.ak.fbcdn.net/hphotos-ak-snc1/5370_127826373305_40796308305_2373079_2781005_n.jpg"
            },
            {
               "height": 254,
               "width": 180,
               "source": "http://photos-d.ak.fbcdn.net/hphotos-ak-snc1/5370_127826373305_40796308305_2373079_2781005_a.jpg"
            },
            {
               "height": 130,
               "width": 91,
               "source": "http://photos-d.ak.fbcdn.net/hphotos-ak-snc1/5370_127826373305_40796308305_2373079_2781005_s.jpg"
            },
            {
               "height": 106,
               "width": 75,
               "source": "http://photos-d.ak.fbcdn.net/hphotos-ak-snc1/5370_127826373305_40796308305_2373079_2781005_t.jpg"
            }
         ],

This is an example from the api documentation. You can use these image links directly, facebook even gives you different sizes for the gallery. Good luck.


yes its possible: Here an example with Graph:

Photos: https://graph.facebook.com/98423808305 (A photo from the Coca-Cola page)

Photo albums: https://graph.facebook.com/99394368305 (Coca-Cola's wall photos)


If you use self hosted domain with Wordpress, you can do it with these steps:

Install and Activate Facebook Photo Fetcher for Wordpress

  1. Download the latest version of Facebook Photo Fetcher plugin for Wordpress http://wordpress.org/extend/plugins/facebook-photo-fetcher/
  2. Extract and activate the plugin via dashboard

Setting for your Facebook Photo Fetcher

  1. Settings > FB Photo Fetcher
  2. Click "Login to Facebook"
  3. Enter your information > Login > close the popup
  4. Grant Photo Permissions > Accept the permissions > Success!
  5. click "Save Facebook Session"

This plugin is successfully connected with your ID Facebook account.

Insert your Facebook Album into Post or Page in Wordpress */

  1. Search for Albums > it will open your album and get you album ID For Example, the album ID is: 123456789987654321 Create a new post or page in wordpress > use HTML editor not visual
  2. Insert this code:

    <!-- FBGallery 1234567890123456789 --> <!--/FBGallery -->
    

    Change 1234567890123456789 with your real facebook album ID.

  3. Save > see your page.

Demo: http://www.justin-klein.com/projects/facebook-photo-fetcher#demo


You will need to manage the authentication firstly. If you are using the facebook php api and its your own photo album you can request permanent access

$facebook->getLoginUrl(array('req_perms' =>'user_photos friends_photos')); }

Then after that you can make requests to the graph api such as http://graph.facebook.com/me/albums - your auth key will at the end of that request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜