Game Development Reference
In-Depth Information
6.
Here is the complete list of the required string constants:
const std::string AppKey = "YourAppKeyHere";
const std::string FlickrAPIBase = "http://api.flickr.com/services/
rest/?method=";
const std::string FlickrFavoritesURL = FlickrAPIBase +
"flickr.interestingness.getList";
const std::string FlickrRecentURL = FlickrAPIBase +
"flickr.photos.getRecent";
const std::string PicasaAPIBase = "http://picasaweb.google.com/
data/feed/api/";
const std::string PicasaFavoritesURL = PicasaAPIBase +
"featured/?";
const std::string PicasaRecentURL = PicasaAPIBase + "all/?";
7.
The MaxResults parameter limits the number of images in the list. The PageIndex
parameter speciies how many result pages to skip, and the SearchQuery string can
be used to fetch only the images with a given text in their description.
8.
The Flickr version uses the AppKey global string constant which should contain the
obtained application key.
How it works…
We form the URL; in this case, it is the irst page of the user upvoted images from Flickr:
string URL = Flickr_GetListURL(FlickrFavoritesURL, 15, 0, "");
Then, we may pass this URL to our HTTP downloader and receive an XML ile with the list of
images. The same can be done with Picasa; note the one-based page indexing:
string URL = Picasa_GetListURL(PicasaFavoritesURL, 15, 1, "");
The complete sources code of these functions is found in the PhotoAPI.cpp ile from the
2_FlickrAndPicasa folder.
There's more…
The provided examples do not contain a valid application key for Flickr. Also remember, that
according to Flickr's license agreement, your application may not show more than ifteen
images on one screen.
There is an extensive documentation of the Flickr API residing at http://www.flickr.
com/services/api/ .
 
Search WWH ::




Custom Search