1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.service.flickr">
4 <title>Zend_Service_Flickr</title>
6 <sect2 id="zend.service.flickr.introduction">
7 <title>Introduction</title>
10 <classname>Zend_Service_Flickr</classname> is a simple <acronym>API</acronym> for using
11 the Flickr REST Web Service. In order to use the Flickr web services, you must have an
12 <acronym>API</acronym> key. To obtain a key and for more information about the Flickr
13 REST Web Service, please visit the <ulink
14 url="http://www.flickr.com/services/api/">Flickr <acronym>API</acronym>
15 Documentation</ulink>.
19 In the following example, we use the <methodname>tagSearch()</methodname> method to
20 search for photos having "php" in the tags.
23 <example id="zend.service.flickr.introduction.example-1">
24 <title>Simple Flickr Photo Search</title>
26 <programlisting language="php"><![CDATA[
27 $flickr = new Zend_Service_Flickr('MY_API_KEY');
29 $results = $flickr->tagSearch("php");
31 foreach ($results as $result) {
32 echo $result->title . '<br />';
38 <title>Optional parameter</title>
41 <methodname>tagSearch()</methodname> accepts an optional second parameter as an
47 <sect2 id="zend.service.flickr.finding-users">
48 <title>Finding Flickr Users' Photos and Information</title>
51 <classname>Zend_Service_Flickr</classname> provides several ways to get information
58 <methodname>userSearch()</methodname>: Accepts a string query of space-delimited
59 tags and an optional second parameter as an array of search options, and returns
60 a set of photos as a <classname>Zend_Service_Flickr_ResultSet</classname>
67 <methodname>getIdByUsername()</methodname>: Returns a string user ID associated
68 with the given username string.
74 <methodname>getIdByEmail()</methodname>: Returns a string user ID associated
75 with the given email address string.
80 <example id="zend.service.flickr.finding-users.example-1">
81 <title>Finding a Flickr User's Public Photos by E-Mail Address</title>
84 In this example, we have a Flickr user's e-mail address, and we search for the
85 user's public photos by using the <methodname>userSearch()</methodname> method:
88 <programlisting language="php"><![CDATA[
89 $flickr = new Zend_Service_Flickr('MY_API_KEY');
91 $results = $flickr->userSearch($userEmail);
93 foreach ($results as $result) {
94 echo $result->title . '<br />';
100 <sect2 id="zend.service.flickr.grouppoolgetphotos">
101 <title>Finding photos From a Group Pool</title>
104 <classname>Zend_Service_Flickr</classname> allows to retrieve a group's pool photos
105 based on the group ID. Use the <methodname>groupPoolGetPhotos()</methodname> method:
108 <example id="zend.service.flickr.grouppoolgetphotos.example-1">
109 <title>Retrieving a Group's Pool Photos by Group ID</title>
111 <programlisting language="php"><![CDATA[
112 $flickr = new Zend_Service_Flickr('MY_API_KEY');
114 $results = $flickr->groupPoolGetPhotos($groupId);
116 foreach ($results as $result) {
117 echo $result->title . '<br />';
123 <title>Optional parameter</title>
126 <methodname>groupPoolGetPhotos()</methodname> accepts an optional second parameter
127 as an array of options.
132 <sect2 id="zend.service.flickr.getimagedetails">
133 <title>Retrieving Flickr Image Details</title>
136 <classname>Zend_Service_Flickr</classname> makes it quick and easy to get an image's
137 details based on a given image ID. Just use the
138 <methodname>getImageDetails()</methodname> method, as in the following example:
141 <example id="zend.service.flickr.getimagedetails.example-1">
142 <title>Retrieving Flickr Image Details</title>
145 Once you have a Flickr image ID, it is a simple matter to fetch information about
149 <programlisting language="php"><![CDATA[
150 $flickr = new Zend_Service_Flickr('MY_API_KEY');
152 $image = $flickr->getImageDetails($imageId);
154 echo "Image ID $imageId is $image->width x $image->height pixels.<br />\n";
155 echo "<a href=\"$image->clickUri\">Click for Image</a>\n";
160 <sect2 id="zend.service.flickr.classes">
161 <title>Zend_Service_Flickr Result Classes</title>
164 The following classes are all returned by <methodname>tagSearch()</methodname> and
165 <methodname>userSearch()</methodname>:
171 linkend="zend.service.flickr.classes.resultset"><classname>Zend_Service_Flickr_ResultSet</classname></link>
178 linkend="zend.service.flickr.classes.result"><classname>Zend_Service_Flickr_Result</classname></link>
185 linkend="zend.service.flickr.classes.image"><classname>Zend_Service_Flickr_Image</classname></link>
191 <sect3 id="zend.service.flickr.classes.resultset">
192 <title>Zend_Service_Flickr_ResultSet</title>
194 <para>Represents a set of Results from a Flickr search.</para>
198 Implements the <classname>SeekableIterator</classname> interface for easy
199 iteration (e.g., using <methodname>foreach()</methodname>), as well as direct
200 access to a specific result using <methodname>seek()</methodname>.
204 <sect4 id="zend.service.flickr.classes.resultset.properties">
205 <title>Properties</title>
207 <table id="zend.service.flickr.classes.resultset.properties.table-1">
208 <title>Zend_Service_Flickr_ResultSet Properties</title>
215 <entry>Description</entry>
221 <entry>totalResultsAvailable</entry>
223 <entry>Total Number of Results available</entry>
227 <entry>totalResultsReturned</entry>
229 <entry>Total Number of Results returned</entry>
233 <entry>firstResultPosition</entry>
235 <entry>The offset in the total result set of this result set</entry>
242 <sect4 id="zend.service.flickr.classes.resultset.totalResults">
243 <title>Zend_Service_Flickr_ResultSet::totalResults()</title>
248 <methodname>totalResults</methodname>
254 Returns the total number of results in this result set.
258 <link linkend="zend.service.flickr.classes">Back to Class List</link>
263 <sect3 id="zend.service.flickr.classes.result">
264 <title>Zend_Service_Flickr_Result</title>
267 A single Image result from a Flickr query
270 <sect4 id="zend.service.flickr.classes.result.properties">
271 <title>Properties</title>
273 <table id="zend.service.flickr.classes.result.properties.table-1">
274 <title>Zend_Service_Flickr_Result Properties</title>
281 <entry>Description</entry>
288 <entry>string</entry>
289 <entry>Image ID</entry>
294 <entry>string</entry>
295 <entry>The photo owner's <acronym>NSID</acronym>.</entry>
299 <entry>secret</entry>
300 <entry>string</entry>
301 <entry>A key used in url construction.</entry>
305 <entry>server</entry>
306 <entry>string</entry>
309 The servername to use for <acronym>URL</acronym> construction.
315 <entry>string</entry>
316 <entry>The photo's title.</entry>
320 <entry>ispublic</entry>
321 <entry>string</entry>
322 <entry>The photo is public.</entry>
326 <entry>isfriend</entry>
327 <entry>string</entry>
330 The photo is visible to you because you are a friend of the
336 <entry>isfamily</entry>
337 <entry>string</entry>
340 The photo is visible to you because you are family of the owner.
345 <entry>license</entry>
346 <entry>string</entry>
347 <entry>The license the photo is available under.</entry>
351 <entry>dateupload</entry>
352 <entry>string</entry>
353 <entry>The date the photo was uploaded.</entry>
357 <entry>datetaken</entry>
358 <entry>string</entry>
359 <entry>The date the photo was taken.</entry>
363 <entry>ownername</entry>
364 <entry>string</entry>
365 <entry>The screenname of the owner.</entry>
369 <entry>iconserver</entry>
370 <entry>string</entry>
373 The server used in assembling icon <acronym>URL</acronym>s.
378 <entry>Square</entry>
382 linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link>
385 <entry>A 75x75 thumbnail of the image.</entry>
389 <entry>Thumbnail</entry>
393 linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link>
396 <entry>A 100 pixel thumbnail of the image.</entry>
404 linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link>
407 <entry>A 240 pixel version of the image.</entry>
411 <entry>Medium</entry>
415 linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link>
418 <entry>A 500 pixel version of the image.</entry>
426 linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link>
429 <entry>A 640 pixel version of the image.</entry>
433 <entry>Original</entry>
437 linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link>
440 <entry>The original image.</entry>
447 <link linkend="zend.service.flickr.classes">Back to Class List</link>
452 <sect3 id="zend.service.flickr.classes.image">
453 <title>Zend_Service_Flickr_Image</title>
455 <para>Represents an Image returned by a Flickr search.</para>
457 <sect4 id="zend.service.flickr.classes.image.properties">
458 <title>Properties</title>
460 <table id="zend.service.flickr.classes.image.properties.table-1">
461 <title>Zend_Service_Flickr_Image Properties</title>
468 <entry>Description</entry>
475 <entry>string</entry>
476 <entry>URI for the original image</entry>
480 <entry>clickUri</entry>
481 <entry>string</entry>
484 Clickable <acronym>URI</acronym> (i.e. the Flickr page) for the
492 <entry>Width of the Image</entry>
496 <entry>height</entry>
498 <entry>Height of the Image</entry>
505 <link linkend="zend.service.flickr.classes">Back to Class List</link>