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']); } function setTags($id, $tags) { $this->flickr->photos_setTags($id, $tags); if ($this->flickr->getErrorCode()) { echo ("Error setting tags: " . $this->flickr->getErrorMsg()); } } function uploadPhoto($file, $title = null, $description = null, $tags = null, $isPublic = null, $isFriend = null, $isFamily = null) { $id = $this->flickr->sync_upload($file, $title, $description, $tags, $isPublic, $isFriend, $isFamily); if ($this->flickr->getErrorCode()) { echo ("Error uploading photo: " . $this->flickr->getErrorMsg()); } return $id; } function replacePhoto($file, $photoId) { $id = $this->flickr->replace($file, $photoId); if ($this->flickr->getErrorCode()) { echo ("Error replacing photo: " . $this->flickr->getErrorMsg()); } return $id; } function getWithGeoData() { $bbox = '-180, -90, 180, 90'; $args = array( 'user_id' => $this->nsid, 'sort' => 'interestingness-desc', 'bbox' => $bbox, 'extras' => 'geo', 'per_page' => 500, ); $p = $this->flickr->photos_search($args); if ($this->flickr->getErrorCode()) { echo ("Error fetching photos with GeoData: " . $this->flickr->getErrorMsg()); } return $p['photo']; } } ?>