Zend_Service_Flickr.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.flickr">
  4. <title>Zend_Service_Flickr</title>
  5. <sect2 id="zend.service.flickr.introduction">
  6. <title>Introduction</title>
  7. <para>
  8. <classname>Zend_Service_Flickr</classname> is a simple API for using the Flickr REST Web Service. In order to use
  9. the Flickr web services, you must have an API key. To obtain a key and for more information about the
  10. Flickr REST Web Service, please visit the
  11. <ulink url="http://www.flickr.com/services/api/">Flickr API Documentation</ulink>.
  12. </para>
  13. <para>
  14. In the following example, we use the <code>tagSearch()</code> method to search for photos having "php"
  15. in the tags.
  16. </para>
  17. <example id="zend.service.flickr.introduction.example-1">
  18. <title>Simple Flickr Photo Search</title>
  19. <programlisting language="php"><![CDATA[
  20. $flickr = new Zend_Service_Flickr('MY_API_KEY');
  21. $results = $flickr->tagSearch("php");
  22. foreach ($results as $result) {
  23. echo $result->title . '<br />';
  24. }
  25. ]]></programlisting>
  26. </example>
  27. <note>
  28. <title>Optional parameter</title>
  29. <para>
  30. <code>tagSearch()</code> accepts an optional second parameter as an array of options.
  31. </para>
  32. </note>
  33. </sect2>
  34. <sect2 id="zend.service.flickr.finding-users">
  35. <title>Finding Flickr Users' Photos and Information</title>
  36. <para>
  37. <classname>Zend_Service_Flickr</classname> provides several ways to get information about Flickr users:
  38. </para>
  39. <itemizedlist>
  40. <listitem>
  41. <para>
  42. <code>userSearch()</code>: Accepts a string query of space-delimited tags and an optional second
  43. parameter as an array of search options, and returns a set of photos as a
  44. <classname>Zend_Service_Flickr_ResultSet</classname> object.
  45. </para>
  46. </listitem>
  47. <listitem>
  48. <para>
  49. <code>getIdByUsername()</code>: Returns a string user ID associated with the given username string.
  50. </para>
  51. </listitem>
  52. <listitem>
  53. <para>
  54. <code>getIdByEmail()</code>: Returns a string user ID associated with the given email address
  55. string.
  56. </para>
  57. </listitem>
  58. </itemizedlist>
  59. <example id="zend.service.flickr.finding-users.example-1">
  60. <title>Finding a Flickr User's Public Photos by E-Mail Address</title>
  61. <para>
  62. In this example, we have a Flickr user's e-mail address, and we search for the user's public photos by
  63. using the <code>userSearch()</code> method:
  64. </para>
  65. <programlisting language="php"><![CDATA[
  66. $flickr = new Zend_Service_Flickr('MY_API_KEY');
  67. $results = $flickr->userSearch($userEmail);
  68. foreach ($results as $result) {
  69. echo $result->title . '<br />';
  70. }
  71. ]]></programlisting>
  72. </example>
  73. </sect2>
  74. <sect2 id="zend.service.flickr.grouppoolgetphotos">
  75. <title>Finding photos From a Group Pool</title>
  76. <para>
  77. <classname>Zend_Service_Flickr</classname> allows to retrieve a group's pool photos based
  78. on the group ID. Use the <code>groupPoolGetPhotos()</code> method:
  79. </para>
  80. <example id="zend.service.flickr.grouppoolgetphotos.example-1">
  81. <title>Retrieving a Group's Pool Photos by Group ID</title>
  82. <programlisting language="php"><![CDATA[
  83. $flickr = new Zend_Service_Flickr('MY_API_KEY');
  84. $results = $flickr->groupPoolGetPhotos($groupId);
  85. foreach ($results as $result) {
  86. echo $result->title . '<br />';
  87. }
  88. ]]></programlisting>
  89. </example>
  90. <note>
  91. <title>Optional parameter</title>
  92. <para>
  93. <code>groupPoolGetPhotos()</code> accepts an optional second parameter as an array of options.
  94. </para>
  95. </note>
  96. </sect2>
  97. <sect2 id="zend.service.flickr.getimagedetails">
  98. <title>Retrieving Flickr Image Details</title>
  99. <para>
  100. <classname>Zend_Service_Flickr</classname> makes it quick and easy to get an image's details based on a given image
  101. ID. Just use the <code>getImageDetails()</code> method, as in the following example:
  102. </para>
  103. <example id="zend.service.flickr.getimagedetails.example-1">
  104. <title>Retrieving Flickr Image Details</title>
  105. <para>
  106. Once you have a Flickr image ID, it is a simple matter to fetch information about the image:
  107. </para>
  108. <programlisting language="php"><![CDATA[
  109. $flickr = new Zend_Service_Flickr('MY_API_KEY');
  110. $image = $flickr->getImageDetails($imageId);
  111. echo "Image ID $imageId is $image->width x $image->height pixels.<br />\n";
  112. echo "<a href=\"$image->clickUri\">Click for Image</a>\n";
  113. ]]></programlisting>
  114. </example>
  115. </sect2>
  116. <sect2 id="zend.service.flickr.classes">
  117. <title>Zend_Service_Flickr Result Classes</title>
  118. <para>
  119. The following classes are all returned by <code>tagSearch()</code> and <code>userSearch()</code>:
  120. <itemizedlist>
  121. <listitem><para><link linkend="zend.service.flickr.classes.resultset"><classname>Zend_Service_Flickr_ResultSet</classname></link></para></listitem>
  122. <listitem><para><link linkend="zend.service.flickr.classes.result"><classname>Zend_Service_Flickr_Result</classname></link></para></listitem>
  123. <listitem><para><link linkend="zend.service.flickr.classes.image"><classname>Zend_Service_Flickr_Image</classname></link></para></listitem>
  124. </itemizedlist>
  125. </para>
  126. <sect3 id="zend.service.flickr.classes.resultset">
  127. <title>Zend_Service_Flickr_ResultSet</title>
  128. <para>Represents a set of Results from a Flickr search.</para>
  129. <note>
  130. <para>
  131. Implements the <code>SeekableIterator</code> interface for easy iteration (e.g., using
  132. <code>foreach</code>), as well as direct access to a specific result using <code>seek()</code>.
  133. </para>
  134. </note>
  135. <sect4 id="zend.service.flickr.classes.resultset.properties">
  136. <title>Properties</title>
  137. <table id="zend.service.flickr.classes.resultset.properties.table-1">
  138. <title>Zend_Service_Flickr_ResultSet Properties</title>
  139. <tgroup cols="3">
  140. <thead>
  141. <row>
  142. <entry>Name</entry>
  143. <entry>Type</entry>
  144. <entry>Description</entry>
  145. </row>
  146. </thead>
  147. <tbody>
  148. <row>
  149. <entry>totalResultsAvailable</entry>
  150. <entry>int</entry>
  151. <entry>Total Number of Results available</entry>
  152. </row>
  153. <row>
  154. <entry>totalResultsReturned</entry>
  155. <entry>int</entry>
  156. <entry>Total Number of Results returned</entry>
  157. </row>
  158. <row>
  159. <entry>firstResultPosition</entry>
  160. <entry>int</entry>
  161. <entry>The offset in the total result set of this result set</entry>
  162. </row>
  163. </tbody>
  164. </tgroup>
  165. </table>
  166. </sect4>
  167. <sect4 id="zend.service.flickr.classes.resultset.totalResults">
  168. <title>Zend_Service_Flickr_ResultSet::totalResults()</title>
  169. <para>
  170. <methodsynopsis>
  171. <type>int</type>
  172. <methodname>totalResults</methodname>
  173. <void />
  174. </methodsynopsis>
  175. </para>
  176. <para>
  177. Returns the total number of results in this result set.
  178. </para>
  179. <para>
  180. <link linkend="zend.service.flickr.classes">Back to Class List</link>
  181. </para>
  182. </sect4>
  183. </sect3>
  184. <sect3 id="zend.service.flickr.classes.result">
  185. <title>Zend_Service_Flickr_Result</title>
  186. <para>
  187. A single Image result from a Flickr query
  188. </para>
  189. <sect4 id="zend.service.flickr.classes.result.properties">
  190. <title>Properties</title>
  191. <table id="zend.service.flickr.classes.result.properties.table-1">
  192. <title>Zend_Service_Flickr_Result Properties</title>
  193. <tgroup cols="3">
  194. <thead>
  195. <row>
  196. <entry>Name</entry>
  197. <entry>Type</entry>
  198. <entry>Description</entry>
  199. </row>
  200. </thead>
  201. <tbody>
  202. <row>
  203. <entry>id</entry>
  204. <entry>string</entry>
  205. <entry>Image ID</entry>
  206. </row>
  207. <row>
  208. <entry>owner</entry>
  209. <entry>string</entry>
  210. <entry>The photo owner's NSID.</entry>
  211. </row>
  212. <row>
  213. <entry>secret</entry>
  214. <entry>string</entry>
  215. <entry>A key used in url construction.</entry>
  216. </row>
  217. <row>
  218. <entry>server</entry>
  219. <entry>string</entry>
  220. <entry>The servername to use for URL construction.</entry>
  221. </row>
  222. <row>
  223. <entry>title</entry>
  224. <entry>string</entry>
  225. <entry>The photo's title.</entry>
  226. </row>
  227. <row>
  228. <entry>ispublic</entry>
  229. <entry>string</entry>
  230. <entry>The photo is public.</entry>
  231. </row>
  232. <row>
  233. <entry>isfriend</entry>
  234. <entry>string</entry>
  235. <entry>The photo is visible to you because you are a friend of the owner.</entry>
  236. </row>
  237. <row>
  238. <entry>isfamily</entry>
  239. <entry>string</entry>
  240. <entry>The photo is visible to you because you are family of the owner.</entry>
  241. </row>
  242. <row>
  243. <entry>license</entry>
  244. <entry>string</entry>
  245. <entry>The license the photo is available under.</entry>
  246. </row>
  247. <row>
  248. <entry>dateupload</entry>
  249. <entry>string</entry>
  250. <entry>The date the photo was uploaded.</entry>
  251. </row>
  252. <row>
  253. <entry>datetaken</entry>
  254. <entry>string</entry>
  255. <entry>The date the photo was taken.</entry>
  256. </row>
  257. <row>
  258. <entry>ownername</entry>
  259. <entry>string</entry>
  260. <entry>The screenname of the owner.</entry>
  261. </row>
  262. <row>
  263. <entry>iconserver</entry>
  264. <entry>string</entry>
  265. <entry>The server used in assembling icon URLs.</entry>
  266. </row>
  267. <row>
  268. <entry>Square</entry>
  269. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  270. <entry>A 75x75 thumbnail of the image.</entry>
  271. </row>
  272. <row>
  273. <entry>Thumbnail</entry>
  274. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  275. <entry>A 100 pixel thumbnail of the image.</entry>
  276. </row>
  277. <row>
  278. <entry>Small</entry>
  279. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  280. <entry>A 240 pixel version of the image.</entry>
  281. </row>
  282. <row>
  283. <entry>Medium</entry>
  284. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  285. <entry>A 500 pixel version of the image.</entry>
  286. </row>
  287. <row>
  288. <entry>Large</entry>
  289. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  290. <entry>A 640 pixel version of the image.</entry>
  291. </row>
  292. <row>
  293. <entry>Original</entry>
  294. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  295. <entry>The original image.</entry>
  296. </row>
  297. </tbody>
  298. </tgroup>
  299. </table>
  300. <para>
  301. <link linkend="zend.service.flickr.classes">Back to Class List</link>
  302. </para>
  303. </sect4>
  304. </sect3>
  305. <sect3 id="zend.service.flickr.classes.image">
  306. <title>Zend_Service_Flickr_Image</title>
  307. <para>Represents an Image returned by a Flickr search.</para>
  308. <sect4 id="zend.service.flickr.classes.image.properties">
  309. <title>Properties</title>
  310. <table id="zend.service.flickr.classes.image.properties.table-1">
  311. <title>Zend_Service_Flickr_Image Properties</title>
  312. <tgroup cols="3">
  313. <thead>
  314. <row>
  315. <entry>Name</entry>
  316. <entry>Type</entry>
  317. <entry>Description</entry>
  318. </row>
  319. </thead>
  320. <tbody>
  321. <row>
  322. <entry>uri</entry>
  323. <entry>string</entry>
  324. <entry>URI for the original image</entry>
  325. </row>
  326. <row>
  327. <entry>clickUri</entry>
  328. <entry>string</entry>
  329. <entry>Clickable URI (i.e. the Flickr page) for the image</entry>
  330. </row>
  331. <row>
  332. <entry>width</entry>
  333. <entry>int</entry>
  334. <entry>Width of the Image</entry>
  335. </row>
  336. <row>
  337. <entry>height</entry>
  338. <entry>int</entry>
  339. <entry>Height of the Image</entry>
  340. </row>
  341. </tbody>
  342. </tgroup>
  343. </table>
  344. <para>
  345. <link linkend="zend.service.flickr.classes">Back to Class List</link>
  346. </para>
  347. </sect4>
  348. </sect3>
  349. </sect2>
  350. </sect1>
  351. <!--
  352. vim:se ts=4 sw=4 et:
  353. -->