Zend_Service_Flickr.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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 <acronym>API</acronym> for using the Flickr REST Web Service. In order to use
  9. the Flickr web services, you must have an <acronym>API</acronym> 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 <acronym>API</acronym> Documentation</ulink>.
  12. </para>
  13. <para>
  14. In the following example, we use the <methodname>tagSearch()</methodname> 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. <methodname>tagSearch()</methodname> 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. <methodname>userSearch()</methodname>: 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. <methodname>getIdByUsername()</methodname>: Returns a string user ID associated with the given username string.
  50. </para>
  51. </listitem>
  52. <listitem>
  53. <para>
  54. <methodname>getIdByEmail()</methodname>: 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 <methodname>userSearch()</methodname> 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 <methodname>groupPoolGetPhotos()</methodname> 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. <methodname>groupPoolGetPhotos()</methodname> 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 <methodname>getImageDetails()</methodname> 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 <methodname>tagSearch()</methodname> and <methodname>userSearch()</methodname>:
  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 <classname>SeekableIterator</classname> interface for easy
  132. iteration (e.g., using <methodname>foreach()</methodname>), as well as direct
  133. access to a specific result using <methodname>seek()</methodname>.
  134. </para>
  135. </note>
  136. <sect4 id="zend.service.flickr.classes.resultset.properties">
  137. <title>Properties</title>
  138. <table id="zend.service.flickr.classes.resultset.properties.table-1">
  139. <title>Zend_Service_Flickr_ResultSet Properties</title>
  140. <tgroup cols="3">
  141. <thead>
  142. <row>
  143. <entry>Name</entry>
  144. <entry>Type</entry>
  145. <entry>Description</entry>
  146. </row>
  147. </thead>
  148. <tbody>
  149. <row>
  150. <entry>totalResultsAvailable</entry>
  151. <entry>int</entry>
  152. <entry>Total Number of Results available</entry>
  153. </row>
  154. <row>
  155. <entry>totalResultsReturned</entry>
  156. <entry>int</entry>
  157. <entry>Total Number of Results returned</entry>
  158. </row>
  159. <row>
  160. <entry>firstResultPosition</entry>
  161. <entry>int</entry>
  162. <entry>The offset in the total result set of this result set</entry>
  163. </row>
  164. </tbody>
  165. </tgroup>
  166. </table>
  167. </sect4>
  168. <sect4 id="zend.service.flickr.classes.resultset.totalResults">
  169. <title>Zend_Service_Flickr_ResultSet::totalResults()</title>
  170. <para>
  171. <methodsynopsis>
  172. <type>int</type>
  173. <methodname>totalResults</methodname>
  174. <void />
  175. </methodsynopsis>
  176. </para>
  177. <para>
  178. Returns the total number of results in this result set.
  179. </para>
  180. <para>
  181. <link linkend="zend.service.flickr.classes">Back to Class List</link>
  182. </para>
  183. </sect4>
  184. </sect3>
  185. <sect3 id="zend.service.flickr.classes.result">
  186. <title>Zend_Service_Flickr_Result</title>
  187. <para>
  188. A single Image result from a Flickr query
  189. </para>
  190. <sect4 id="zend.service.flickr.classes.result.properties">
  191. <title>Properties</title>
  192. <table id="zend.service.flickr.classes.result.properties.table-1">
  193. <title>Zend_Service_Flickr_Result Properties</title>
  194. <tgroup cols="3">
  195. <thead>
  196. <row>
  197. <entry>Name</entry>
  198. <entry>Type</entry>
  199. <entry>Description</entry>
  200. </row>
  201. </thead>
  202. <tbody>
  203. <row>
  204. <entry>id</entry>
  205. <entry>string</entry>
  206. <entry>Image ID</entry>
  207. </row>
  208. <row>
  209. <entry>owner</entry>
  210. <entry>string</entry>
  211. <entry>The photo owner's <acronym>NSID</acronym>.</entry>
  212. </row>
  213. <row>
  214. <entry>secret</entry>
  215. <entry>string</entry>
  216. <entry>A key used in url construction.</entry>
  217. </row>
  218. <row>
  219. <entry>server</entry>
  220. <entry>string</entry>
  221. <entry>The servername to use for <acronym>URL</acronym> construction.</entry>
  222. </row>
  223. <row>
  224. <entry>title</entry>
  225. <entry>string</entry>
  226. <entry>The photo's title.</entry>
  227. </row>
  228. <row>
  229. <entry>ispublic</entry>
  230. <entry>string</entry>
  231. <entry>The photo is public.</entry>
  232. </row>
  233. <row>
  234. <entry>isfriend</entry>
  235. <entry>string</entry>
  236. <entry>The photo is visible to you because you are a friend of the owner.</entry>
  237. </row>
  238. <row>
  239. <entry>isfamily</entry>
  240. <entry>string</entry>
  241. <entry>The photo is visible to you because you are family of the owner.</entry>
  242. </row>
  243. <row>
  244. <entry>license</entry>
  245. <entry>string</entry>
  246. <entry>The license the photo is available under.</entry>
  247. </row>
  248. <row>
  249. <entry>dateupload</entry>
  250. <entry>string</entry>
  251. <entry>The date the photo was uploaded.</entry>
  252. </row>
  253. <row>
  254. <entry>datetaken</entry>
  255. <entry>string</entry>
  256. <entry>The date the photo was taken.</entry>
  257. </row>
  258. <row>
  259. <entry>ownername</entry>
  260. <entry>string</entry>
  261. <entry>The screenname of the owner.</entry>
  262. </row>
  263. <row>
  264. <entry>iconserver</entry>
  265. <entry>string</entry>
  266. <entry>The server used in assembling icon <acronym>URL</acronym>s.</entry>
  267. </row>
  268. <row>
  269. <entry>Square</entry>
  270. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  271. <entry>A 75x75 thumbnail of the image.</entry>
  272. </row>
  273. <row>
  274. <entry>Thumbnail</entry>
  275. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  276. <entry>A 100 pixel thumbnail of the image.</entry>
  277. </row>
  278. <row>
  279. <entry>Small</entry>
  280. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  281. <entry>A 240 pixel version of the image.</entry>
  282. </row>
  283. <row>
  284. <entry>Medium</entry>
  285. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  286. <entry>A 500 pixel version of the image.</entry>
  287. </row>
  288. <row>
  289. <entry>Large</entry>
  290. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  291. <entry>A 640 pixel version of the image.</entry>
  292. </row>
  293. <row>
  294. <entry>Original</entry>
  295. <entry><link linkend="zend.service.flickr.classes.image">Zend_Service_Flickr_Image</link></entry>
  296. <entry>The original image.</entry>
  297. </row>
  298. </tbody>
  299. </tgroup>
  300. </table>
  301. <para>
  302. <link linkend="zend.service.flickr.classes">Back to Class List</link>
  303. </para>
  304. </sect4>
  305. </sect3>
  306. <sect3 id="zend.service.flickr.classes.image">
  307. <title>Zend_Service_Flickr_Image</title>
  308. <para>Represents an Image returned by a Flickr search.</para>
  309. <sect4 id="zend.service.flickr.classes.image.properties">
  310. <title>Properties</title>
  311. <table id="zend.service.flickr.classes.image.properties.table-1">
  312. <title>Zend_Service_Flickr_Image Properties</title>
  313. <tgroup cols="3">
  314. <thead>
  315. <row>
  316. <entry>Name</entry>
  317. <entry>Type</entry>
  318. <entry>Description</entry>
  319. </row>
  320. </thead>
  321. <tbody>
  322. <row>
  323. <entry>uri</entry>
  324. <entry>string</entry>
  325. <entry>URI for the original image</entry>
  326. </row>
  327. <row>
  328. <entry>clickUri</entry>
  329. <entry>string</entry>
  330. <entry>Clickable <acronym>URI</acronym> (i.e. the Flickr page) for the image</entry>
  331. </row>
  332. <row>
  333. <entry>width</entry>
  334. <entry>int</entry>
  335. <entry>Width of the Image</entry>
  336. </row>
  337. <row>
  338. <entry>height</entry>
  339. <entry>int</entry>
  340. <entry>Height of the Image</entry>
  341. </row>
  342. </tbody>
  343. </tgroup>
  344. </table>
  345. <para>
  346. <link linkend="zend.service.flickr.classes">Back to Class List</link>
  347. </para>
  348. </sect4>
  349. </sect3>
  350. </sect2>
  351. </sect1>
  352. <!--
  353. vim:se ts=4 sw=4 et:
  354. -->