Zend_Service_Flickr.xml 19 KB

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