I am creating an external photo gallery using PHP and the Facebook graph API. It pulls thumbnails as well as the large image from albums on our Facebook Fan Page.
You need to retrieve all the albums and then get all the photos. This can be easily done by using FQL:
SELECT pid,owner,src_small,src_big
FROM photo
WHERE aid IN (
SELECT aid
FROM album
WHERE owner = your_page_id
)
EDIT:
Also you need to query the stream table to get the wall posts then check if you have attachments and the type of the attachment:
SELECT attachment
FROM stream
WHERE source_id = 116860675007039
Result:
[
{
"attachment": {
"media": [
{
"href": "http://www.facebook.com/photo.php?fbid=1801693052786&set=o.116860675007039",
"alt": "test",
"type": "photo",
"src": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc6/185861_1801693052786_1553635161_1863491_4978966_s.jpg",
"photo": {
"aid": "6672812206410774346",
"pid": "6672812206412558147",
"fbid": 1801693052786,
"owner": 1553635161,
"index": 11,
"width": 246,
"height": 198
}
}
],
"name": "",
"caption": "",
"description": "",
"properties": [],
"icon": "http://b.static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"fb_object_type": "photo",
"fb_object_id": "6672812206412558147"
}
},
{
"attachment": {
"description": ""
}
},
...etc
]