Zend_Service_FlickrIntroductionZend_Service_Flickr is a simple API for using
the Flickr REST Web Service. In order to use the Flickr web services, you must have an
API key. To obtain a key and for more information about the Flickr
REST Web Service, please visit the Flickr API
Documentation.
In the following example, we use the tagSearch() method to
search for photos having "php" in the tags.
Simple Flickr Photo SearchtagSearch("php");
foreach ($results as $result) {
echo $result->title . ' ';
}
]]>Optional parametertagSearch() accepts an optional second parameter as an
array of options.
Finding Flickr Users' Photos and InformationZend_Service_Flickr provides several ways to get information
about Flickr users:
userSearch(): Accepts a string query of space-delimited
tags and an optional second parameter as an array of search options, and returns
a set of photos as a Zend_Service_Flickr_ResultSet
object.
getIdByUsername(): Returns a string user ID associated
with the given username string.
getIdByEmail(): Returns a string user ID associated
with the given email address string.
Finding a Flickr User's Public Photos by E-Mail Address
In this example, we have a Flickr user's e-mail address, and we search for the
user's public photos by using the userSearch() method:
userSearch($userEmail);
foreach ($results as $result) {
echo $result->title . ' ';
}
]]>Finding photos From a Group PoolZend_Service_Flickr allows to retrieve a group's pool photos
based on the group ID. Use the groupPoolGetPhotos() method:
Retrieving a Group's Pool Photos by Group IDgroupPoolGetPhotos($groupId);
foreach ($results as $result) {
echo $result->title . ' ';
}
]]>Optional parametergroupPoolGetPhotos() accepts an optional second parameter
as an array of options.
Retrieving Flickr Image DetailsZend_Service_Flickr makes it quick and easy to get an image's
details based on a given image ID. Just use the
getImageDetails() method, as in the following example:
Retrieving Flickr Image Details
Once you have a Flickr image ID, it is a simple matter to fetch information about
the image:
getImageDetails($imageId);
echo "Image ID $imageId is $image->width x $image->height pixels. \n";
echo "clickUri\">Click for Image\n";
]]>Zend_Service_Flickr Result Classes
The following classes are all returned by tagSearch() and
userSearch():
Zend_Service_Flickr_ResultSetZend_Service_Flickr_ResultZend_Service_Flickr_ImageZend_Service_Flickr_ResultSetRepresents a set of Results from a Flickr search.
Implements the SeekableIterator interface for easy
iteration (e.g., using foreach()), as well as direct
access to a specific result using seek().
Properties
Zend_Service_Flickr_ResultSet PropertiesNameTypeDescriptiontotalResultsAvailableintTotal Number of Results availabletotalResultsReturnedintTotal Number of Results returnedfirstResultPositionintThe offset in the total result set of this result set
Zend_Service_Flickr_ResultSet::totalResults()inttotalResults
Returns the total number of results in this result set.
Back to Class List
Zend_Service_Flickr_Result
A single Image result from a Flickr query
Properties
Zend_Service_Flickr_Result PropertiesNameTypeDescriptionidstringImage IDownerstringThe photo owner's NSID.secretstringA key used in url construction.serverstring
The servername to use for URL construction.
titlestringThe photo's title.ispublicstringThe photo is public.isfriendstring
The photo is visible to you because you are a friend of the
owner.
isfamilystring
The photo is visible to you because you are family of the owner.
licensestringThe license the photo is available under.dateuploadstringThe date the photo was uploaded.datetakenstringThe date the photo was taken.ownernamestringThe screenname of the owner.iconserverstring
The server used in assembling icon URLs.
Square
Zend_Service_Flickr_Image
A 75x75 thumbnail of the image.Thumbnail
Zend_Service_Flickr_Image
A 100 pixel thumbnail of the image.Small
Zend_Service_Flickr_Image
A 240 pixel version of the image.Medium
Zend_Service_Flickr_Image
A 500 pixel version of the image.Large
Zend_Service_Flickr_Image
A 640 pixel version of the image.Original
Zend_Service_Flickr_Image
The original image.
Back to Class List
Zend_Service_Flickr_ImageRepresents an Image returned by a Flickr search.Properties
Zend_Service_Flickr_Image PropertiesNameTypeDescriptionuristringURI for the original imageclickUristring
Clickable URI (i.e. the Flickr page) for the
image
widthintWidth of the ImageheightintHeight of the Image