I'm using the graph api to get a users album id and count, then from there get the photos in that album. The total photo count will be 14. The way I am currently doing it, it uses file_get_contents() on the actual API which is then done multiple times. I would prefer to do one FQL type query while maintaining support for the new graph API.
So that you guys can see what I'm doing here are the two functions I'm referring to:
function get_facebook_albums() {
$url = 'http://graph.facebook.com/' . $this->fb_id . '/albums';
$result = file_get_contents( $url );
$result = json_decode($result);
$i = 0;
while( $i <= 14 ) {
foreach( $result->data as $info ) {
$this->fb_albums[$info->name] = array('id'=>$info->id, 'count'=>$info->count);
$i + $info->count;
}
}
}
function build_facebook_photos_array() {
$images = array();
$i = 0;
foreach( $this->fb_albums as $key=>$album ) {
$photos = $this->get_facebook_photos( $album );
foreach( $photos->data as $photo ) {
while($i <= 14) {
$url = sprintf('http://graph.facebook.com/%s', $photo->id);
$result = file_get_contents( $url );
$image_set = json_decode($result);
$images[$i]['small'] = $image_set->picture;
$images[$i]['large'] = $image_set->source;
$i++;
}
} // album data
} // foreach album
return $images;
Any help would be greatly appreciated as I would love to do just one call with array like so:
[albumid]=>
array('photo_id' =>
array('large'=> source,
'small'=> picture)
)

New Topic/Question
Reply




MultiQuote







|