Sorry if this seems like a dumb question, but I am realizing I have a LOT to learn about PHP. I was wondering what am I skipping, because as the title says, my image gallery using PHP takes images from a facebook site, but only pulls the first 25 pictures everytime, and all the pictures are public and uploaded by the same person. I am using a tutorial taken from this site: http://www.webdesignermag.co.uk/tutorials/facebook-image-gallery/
And the code used specifically is this:
<?php
//Set the page name or ID
$FBid = 'ArazaArtesanias';
//Get the contents of a Facebook page
$FBpage = file_get_contents('https://graph.facebook.com/'.$FBid.'/albums');
//Interpret data with JSON
$photoData = json_decode($FBpage);
echo '<ul id="display-inline-block">';
foreach ( $photoData->data as $data )
{
echo '<li><a href="getphotos.php?album_id='.$data->id.'">
<img class="shadow" src="https://graph.facebook.com/'.$data->id.'/picture/" width=70 border=0 />
</a>';
echo '<br /><a href="getphotos.php?album_id='.$data->id.'">'.$data->name.'</a></li>';
}
echo '</ul>';
?>
And for the individual albums gallery is this:
<?php
//Get the contents of the album data page
$rawAlbumData = file_get_contents('https://graph.facebook.com/'.$_GET['album_id'].'/photos');
//Interpret data with JSON
$photoData = json_decode($rawAlbumData);
echo '<ul id="display-inline-block">';
foreach ( $photoData->data as $data )
{
echo '<li><a href="'.$data->source.'" rel="lightbox" title="';
if (property_exists($data, "comments")) {
foreach ( $data->comments->data as $Cdata )
{
echo htmlentities('<li class="imgcomments">
<a href="http://www.facebook.com/people/@/'.$Cdata->from->id.'" target="_blank"> <img src="https://graph.facebook.com/'.$Cdata->from->id.'/picture"
align=left border=0 />
</a>
<a href="http://www.facebook.com/people/@/'.$Cdata->from->id.'" target="_blank">
<b>'.$Cdata->from->name.'</a>: </b>'.$Cdata->message.'<br />
<div align="left" style="padding-bottom:10px;">
<small> Posted '.timeSince(strtotime($Cdata->created_time)).' ago</small></div> </li>');
}
}
else {
echo 'There are no comments on this album';
}
echo '"><img class="shadow" src="'.$data->picture.'" width=70 border=0 /></a></li>';
}
echo '</ul>';
//Get data about the photo album
$rawCommentData = file_get_contents('https://graph.facebook.com/'.$_GET['album_id']);
//Interpret comment data with JSON
$commentData = json_decode($rawCommentData);
echo '<div class="comments">';
echo '<h2>Album Comments</h2>';
if ( $commentData->comments->data ) {
foreach ( $commentData->comments->data as $data )
{
echo ' <a href="http://www.facebook.com/people/@/'.$data->from->id.'" target="_blank"><b>'
.$data->from->name.'</a>: </b>'.$data->message.'<br/><div align="left" style="padding-bottom:10px;">
<small> Posted '.timeSince(strtotime($data->created_time)).' ago</small></div></li>';
}
}
else {
echo 'There are no comments on this album';
}
echo '</div>';
?>