topical media & game development
mashup-flickr-14-Step-3-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(recentPhotos = array();
if (sql = "SELECT * FROM photo ORDER BY photo_date_upload DESC LIMIT res = mysql_query(this->getConnection())
or die("Invalid query: " . row = mysql_fetch_assoc(photo = row);
array_push(photo);
}
}
else
{
this->nsid,
'sort' => 'date-posted-desc',
'page' => 1,
'per_page' => p = args);
if (this->flickr->getErrorMsg());
}
p['photo'];
}
return id)
{
this->flickr->photos_getInfo(this->flickr->getErrorCode())
{
echo ("Error getting photo info: " . p;
}
function showSmartSetThumbnail(title = "Set", tags = "",
sort = "date-posted-desc")
{
url = title) . '&tags=' . urlencode(n&tagMode=sort";
// Get image to display
this->getSmartSet(1, tagMode, photos) && count(photo = img = 'http://static.flickr.com/' . photo['id']
. '_' . s .= "<a href=\"img\" /></a>";
title . "</p>";
}
return n = 20, tagMode = "all",
ret = array();
this->nsid,
'sort' => n,
'extras' => 'owner_name'
);
if (!empty(args['tags'] = args['tag_mode'] = p = args);
if (this->flickr->getErrorMsg());
}
if (is_array(p['photo']) > 0)
{
p['photo'];
}
return id, description)
{
id, description);
if (this->flickr->getErrorMsg());
}
}
function checkAuthenticatedUser()
{
return (this->auth['user']['nsid']);
}
function setTags(tags)
{
id, this->flickr->getErrorCode())
{
echo ("Error setting tags: " . file, description = null, isPublic = null, isFamily = null)
{
this->flickr->sync_upload(title, tags, isFriend, this->flickr->getErrorCode())
{
echo ("Error uploading photo: " . id;
}
function replacePhoto(photoId)
{
this->flickr->replace(photoId);
if (this->flickr->getErrorMsg());
}
return bbox = NULL)
{
if (bbox = '-180, -90, 180, 90';
}
this->nsid,
'sort' => 'interestingness-desc',
'bbox' => p = args);
if (this->flickr->getErrorMsg());
}
return this->connection))
{
this->dbhost,
this->dbpasswd);
if (!this->dbhost);
}
this->dbname, ret)
{
die ("Cannot access database " . this->dbhostname);
}
}
return sql = "DELETE FROM photo";
mysql_query(this->getConnection()) or die("Invalid query: " . this->flushDBPhotos();
set_time_limit(240);
keepGoing = 1;
keepGoing)
{
this->nsid,
'sort' => 'date-posted-desc',
'page' => p = args);
if (this->flickr->getErrorMsg());
}
if (count(p['photo'] as sql = sprintf(photo['id'], photo['server'],
photo['ownername']),
photo['isfriend'], photo['datetaken'], photo['dateupload'],
mysql_escape_string(photo['latitude'],
photo['accuracy']);
mysql_query(this->getConnection())
or die("Invalid query: " . page++;
}
}
function buildPhotoFromRow(photo = array();
row['photo_id'];
row['photo_secret'];
row['photo_server'];
row['photo_owner'];
row['photo_owner_name'];
row['photo_title'];
row['photo_is_public'];
row['photo_is_friend'];
row['photo_is_family'];
row['photo_date_upload'];
row['photo_date_taken'];
row['photo_date_taken_granularity'];
row['photo_latitude'];
row['photo_longitude'];
row['photo_accuracy'];
return
(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.