-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
54 lines (53 loc) · 2.86 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CFlickr 2</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>CFlickr 2 - Coldfusion Flickr API Kit </h1>
<h3>Introduction</h3>
<p>CFlickr version 2 does away with the numerous cfcs used inthe original version and the one-to-one mapping of methods in the interfaces. Instead version 2 now uses onMissingMethod to dynamically call methods of Flickrs API and receives a response in JSON format which is then deserialized and returned directly.</p>
<p>This simple approach has a few advantages and disadvantages</p>
<p><strong>Pros</strong></p>
<ul>
<li>Extremely lightweight, no longer need to instantiate multiple cfc's to represent a api response</li>
<li>Very easy to work with returned data, everything is represented as Coldfusion Structs, Arrays and Strings.</li>
<li>CFlickr.cfc can now be placed anywhere in your application, no more need for mappings or installation in the webroot</li>
</ul>
<p><strong>Cons</strong></p>
<ul>
<li>CF8+ required for onMissingMethod support</li>
<li>You must always used named arguments to your method calls, for exmaple cflickr.auth_getToken(frob='1234')</li>
</ul>
<h3>Installation</h3>
<p>Place the CFlickr.cfc anywhere you want</p>
<h3>Documentation</h3>
<p>CFC Documentation available <a href="docs/" target="_blank">here</a></p>
<p>CFlickr can call any method of the <a href="http://www.flickr.com/services/api/">Flickr API</a>, it uses onMissingMethod internally to convert the method name you supply into the correct format. Simply drop "flickr" from the method name and convert the periods to underscores.</p>
<p>For example to call <a href="http://www.flickr.com/services/api/flickr.photos.search.html">flickr.photos.search</a> you would call the method <em>photos_search()</em> on the cflickr object. </p>
<h3>Example Usage </h3>
<div class="code">
<pre>
<cfscript>
apikey = "3eaabc8a5b60e6dc9fcf91fe4ccd6b8f";
secret = "c4817e8ac6085693";
cflickr = createobject("component", "cfc.CFlickr").init(apikey, secret);
resp = cflickr.photos_getRecent(per_page=25, page=1);
</cfscript>
<h3>Recent Public Photos<h3>
<div style="width:400px;">
<cfloop from="1" to="#arraylen(resp.photos.photo)#" index="i">
<cfset p = resp.photos.photo[i] />
<cfoutput>
<a href="http://flickr.com/photo.gne?id=#p.id#">
<img src="#cflickr.getPhotoUrl(p, 's')#" />
</a>
</cfoutput>
</cfloop>
<div></pre>
</div>
<p> </p>
</body>
</html>