topical media & game development
mashup-flickr-14-Step-2-lib-FlickrGallery.php / php
<?php
class FlickrGallery extends FlickrAuthenticator
{
var connection = 0;
var dbhost;
var dbuser;
var flickrApiKey;
global this->FlickrAuthenticator(flickrApiSecret);
global dbname;
global dbpasswd;
dbhost;
dbname;
dbuser;
dbpasswd;
}
function findRecentPhotos(args = array(
'user_id' => n
);
this->flickr->photos_search(this->flickr->getErrorCode())
{
echo ("Error fetching photos: " . p['photo'];
}
function getPhotoInfo(p = id);
if (this->flickr->getErrorMsg());
}
return linkPage, n = 20, tagMode = "all", s = "";
linkPage . '?title=' . urlencode(tags)
. "&n=tagMode&sort=photos = tags, sort);
if (is_array(photos) > 0)
{
photos[0];
photo['server'] . '/' . photo['secret'] . '_s.jpg';
url\"><img src=\"s .= "<p class=\"smart-set-caption\">" . s;
}
function getSmartSet(tags = "", sort = "date-posted-desc")
{
args = array(
'user_id' => sort,
'page' => 1,
'per_page' => tags))
{
tags;
tagMode;
}
this->flickr->photos_search(this->flickr->getErrorCode())
{
echo ("Error fetching photos: " . p['photo']) && count(ret = ret;
}
function setMeta(title, this->flickr->photos_setMeta(title, this->flickr->getErrorCode())
{
echo ("Error setting metadata: " . this->nsid == id, this->flickr->photos_setTags(tags);
if (this->flickr->getErrorMsg());
}
}
function uploadPhoto(title = null, tags = null,
isFriend = null, id = file, description, isPublic,
isFamily);
if (this->flickr->getErrorMsg());
}
return file, id = file, this->flickr->getErrorCode())
{
echo ("Error replacing photo: " . id;
}
function getWithGeoData(bbox == NULL)
{
args = array(
'user_id' => bbox,
'extras' => 'geo',
'per_page' => 500,
);
this->flickr->photos_search(this->flickr->getErrorCode())
{
echo ("Error fetching photos with GeoData: " . p['photo'];
}
function getConnection()
{
if (empty(this->connection = mysql_connect(this->dbuser, this->connection)
{
die ("Cannot connect to database server: " . ret = mysql_select_db(this->connection);
if (!this->dbname . " on " . this->connection;
}
function flushDBPhotos()
{
sql, sql);
}
function populateDBPhotos()
{
q = "INSERT INTO photo"
. " (photo_id, photo_secret, photo_server, photo_owner, photo_owner_name,"
. " photo_is_public, photo_is_friend, photo_is_family,"
. " photo_date_taken, photo_date_taken_granularity, photo_date_upload,"
. " photo_title, photo_latitude, photo_longitude, photo_accuracy)"
. " VALUES"
. " ('\%s', '\%s', \%d, '\%s', '\%s', \%d, \%d, \%d, '\%s', \%d, \%d, '\%s',"
. " \%f, \%f, \%d)";
page = 1;
while (args = array(
'user_id' => page,
'per_page' => 500,
'extras' => 'date_upload, date_taken, owner_name, geo'
);
this->flickr->photos_search(this->flickr->getErrorCode())
{
echo ("Error fetching photos: " . p['photo']) == 0)
{
// no more photos
break;
}
foreach(photo)
{
q, photo['secret'], photo['owner'], mysql_escape_string(photo['ispublic'], photo['isfamily'],
photo['datetakengranularity'],
photo['title']), photo['longitude'], sql, sql);
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.