function create_uplFlickr_obj() { global $bhfpf; unset($_SESSION['uplFlickr_auth_token']); $bhfpf = new uplFlickr(get_option('afg_api_key'), get_option('afg_api_secret') ? get_option('afg_api_secret') : NULL); $bhfpf->setToken(get_option('phpFlickr_auth_token')); }
<?php /* Last updated with uplFlickr 1.4 * * If you need your app to always login with the same user (to see your private * photos or photosets, for example), you can use this file to login and get a * token assigned so that you can hard code the token to be used. To use this * use the uplFlickr::setToken() function whenever you create an instance of * the class. */ require_once "uplFlickr.php"; $bhfpf = new uplFlickr("<api key>", "<secret>"); //change this to the permissions you will need $bhfpf->auth("read"); echo "Copy this token into your code: " . $_SESSION['uplFlickr_auth_token'];
<?php /* Last updated with phpFlickr 1.3.2 * * This example file shows you how to call the 100 most recent public * photos. It parses through them and prints out a link to each of them * along with the owner's name. * * Most of the processing time in this file comes from the 100 calls to * flickr.people.getInfo. Enabling caching will help a whole lot with * this as there are many people who post multiple photos at once. * * Obviously, you'll want to replace the "<api key>" with one provided * by Flickr: http://www.flickr.com/services/api/key.gne */ require_once uplFlickr; $bhfpf = new uplFlickr("<api key>"); $recent = $bhfpf->photos_getRecent(); foreach ($recent['photo'] as $photo) { $owner = $bhfpf->people_getInfo($photo['owner']); echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>"; echo $photo['title']; echo "</a> Owner: "; echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>"; echo $owner['username']; echo "</a><br>"; }