How can I show the album cover with Facebook Graph API

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

Answers


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?>

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.


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


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


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.


Need Your Help

How to add a new kernel to grub2

linux ubuntu kernel grub

How can we add a kernel to grub2? i knew the stuff we could do with the former versions, but it seems to have changed. What files should we edit?

How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

ruby proxy rubygems ironruby

The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?