Home › Forums › Other › client wants to add images to gallery page › Re: client wants to add images to gallery page
January 18, 2011 at 6:03 pm
#65383
Member
This is how to pull images from a users timeline
This could go on your page that you want to pull in the images.
require_once("phpFlickr.php");
// Create new phpFlickr object
// get api key from here http://www.flickr.com/services/api/misc.api_keys.html
$f = new phpFlickr("PUT YOUR APIKEY HERE");
$f->enableCache(
"db",
"mysql://USERNAME:[email protected] ADDRESS/DATABASENAME"
);
?>
// Find the NSID of the username inputted via the form
$person = $f->people_findByUsername('FLICKRUSERNAME');
// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos($person);
// Get the user's first 36 public photos
$photos = $f->people_getPublicPhotos($person, NULL, NULL, 18);
// Loop through the photos and output the html
foreach ((array)$photos as $photo) {
echo "buildPhotoURL($photo, "Medium") . ">";
echo "
"src=" . $f->buildPhotoURL($photo, "Square") . " />";
echo " ";
//If it reaches the sixth photo, insert a line break
}
?>