Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other client wants to add images to gallery page Re: client wants to add images to gallery page

#65383
dhechler
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:PASSWORD@MYSQL 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 "$photo[title] "src=" . $f->buildPhotoURL($photo, "Square") . " />";
    echo "
  • ";
    //If it reaches the sixth photo, insert a line break
    }
    ?>