12

This is the code to display the page-picture:

<img src="https://graph.facebook.com/157295940962451/picture"/>

How can I show the album cover of a given album in this page

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
Øyvind
  • 979
  • 4
  • 17
  • 34

5 Answers5

30

Not sure if I am doing something wrong, but just wanted to point out that these answers did not work for me until I appended my access_token to the url:

https://graph.facebook.com/<?=$album['id']?>/picture?type=album&access_token=<?=$access_token?>
Simon Lang
  • 40,171
  • 9
  • 49
  • 58
6

Try:

https://graph.facebook.com/157295940962451/picture?type=normal

Supported types: small, normal, large, square


To get the album cover, you need first to get the album id:

$facebook->api("/PAGE_ID/albums");

This should return something like "PAGEID_ALBUMID" and then you use the same approach.

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
ifaour
  • 38,035
  • 12
  • 72
  • 79
  • 1
    Only thumbnail, normal, album are actually supported for album cover photos, so far as I can see. Asking for small or thumbnail return Internal Server Error. – Dave Jun 04 '12 at 22:22
5

You can get cover photo directly using below url

http://graph.facebook.com/{user_id or page_id}?fields=cover


solution is already posted here Getting Facebooks' Cover Photo via PHP SDK & Graph API

Community
  • 1
  • 1
Mohd Shahid
  • 1,538
  • 2
  • 33
  • 66
2

You can get all the albums with:

https://graph.facebook.com/Your_ID/albums

Then you use cover_photo of a given album

<img src="https://graph.facebook.com/cover_photo/picture?type=album" alt="" />

Supported types: thumbnail, normal, album

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
alanmi2
  • 61
  • 8
0

None of those methods worked for me. I found out by accident how to it with the current status of the API, though. Here it is, perform this fql query, replacing the 'token' with your generated credentials:

https://graph.facebook.com/fql?
q=SELECT pid, src_big FROM photo WHERE owner = me() &access_token='token'

This will return only one picture in the JSON. But, it's the last picture from the first album, which is...the current cover photo. It is the default behaviour. Quite weird, but it solves the problem.

Thiago Ganzarolli
  • 1,161
  • 12
  • 17