FlickrAuthenticator($flickrApiKey, $flickrApiSecret);
}
function findRecentPhotos($n = 20)
{
$args = array(
'user_id' => $this->nsid,
'sort' => 'date-posted-desc',
'page' => 1,
'per_page' => $n
);
$p = $this->flickr->photos_search($args);
if ($this->flickr->getErrorCode())
{
echo ("Error fetching photos: " . $this->flickr->getErrorMsg());
}
return $p['photo'];
}
function getPhotoInfo($id)
{
$p = $this->flickr->photos_getInfo($id);
if ($this->flickr->getErrorCode())
{
echo ("Error getting photo info: " . $this->flickr->getErrorMsg());
}
return $p;
}
function showSmartSetThumbnail($linkPage, $title = "Set", $n = 20, $tags = "",
$tagMode = "all", $sort = "date-posted-desc")
{
$s = "";
$url = $linkPage . '?title=' . urlencode($title) . '&tags=' . urlencode($tags)
. "&n=$n&tagMode=$tagMode&sort=$sort";
// Get image to display
$photos = $this->getSmartSet(1, $tags, $tagMode, $sort);
if (is_array($photos) && count($photos) > 0)
{
$photo = $photos[0];
$img = 'http://static.flickr.com/' . $photo['server'] . '/' . $photo['id']
. '_' . $photo['secret'] . '_s.jpg';
$s .= "";
$s .= "
" . $title . "
"; } return $s; } function getSmartSet($n = 20, $tags = "", $tagMode = "all", $sort = "date-posted-desc") { $ret = array(); $args = array( 'user_id' => $this->nsid, 'sort' => $sort, 'page' => 1, 'per_page' => $n, 'extras' => 'owner_name' ); if (!empty($tags)) { $args['tags'] = $tags; $args['tag_mode'] = $tagMode; } $p = $this->flickr->photos_search($args); if ($this->flickr->getErrorCode()) { echo ("Error fetching photos: " . $this->flickr->getErrorMsg()); } if (is_array($p['photo']) && count($p['photo']) > 0) { $ret = $p['photo']; } return $ret; } function setMeta($id, $title, $description) { $this->flickr->photos_setMeta($id, $title, $description); if ($this->flickr->getErrorCode()) { echo ("Error setting metadata: " . $this->flickr->getErrorMsg()); } } function checkAuthenticatedUser() { return ($this->nsid == $this->auth['user']['nsid']); } } ?>