Coldfusion Flickr JSON

Last weekday, I've read Flickr API developers section. As we all know, there is already CFlickr which support us to integrate CF and Flickr for uploading photos, retrieving photos and so on. But, I'm getting sick of installing this CFlickr in my blog because I only need to display my photography in my blog and don't want to upload and edit anymore.

To display Flickr in our blog, we can also use with RSS feed. If we use RSS feed by retrieving data from Flickr, Flickr will product small images. I've already posted about it in my blog already. Simple Flickr Integration But I don't like those small thumbnail. What I gonna do if I want to display medium thumbail? Answer is very simple. "Use Flickr API"

Usage of Flickr API

view plain print about
1url : http://www.flickr.com/services/rest/
2<!---
3    I need to use this method.
4    Because it's only for display.
5--->

6method : flickr.photos.search
7<!---
8    There are 3 types of format.
9 1. REST (JSON)
10 2. XML-RPC
11 3. SOAP
12    But I only need to use JSON.
13 --->

14format : json
15<!---
16    I only retrieve data.
17    That's why nojsoncallback is 1 (Yes).
18--->

19nojsoncallback : 1
20<!--- Your API --->
21api_key : [YOUR_API_KEY]
22<!--- Your Flickr Account --->
23user_id : [YOUR_USER_ID]

[More]

Simple Flickr Integration

Today, I've developed Simple Flickr Integration with Coldfusion. It's just simple and no thing to be surprised what I've done. As we all, Flickr support us to give API features for integrate with them. But, it's not right time for me to use this Flickr API because I don't want to upload any photo to Flickr via my blog or website because of bandwidth limitation at my hosting.

Here is coding which fetch photograph from Flickr.

view plain print about
1<!--- Get Flickr RSS --->
2<cfhttp url="[your_rss_feed_from_flickr]" method="GET"></cfhttp>
3<cfscript>
4    FlickrContent = trim(cfhttp.filecontent);
5    FlickrContent = XMLParse(FlickrContent);
6
</cfscript>
7<table border="0" width="100%" cellpadding="5" cellspacing="5">
8<tr>
9<cfloop from="1" to="#ArrayLen(FlickrContent.rss.channel.item)#" index="i">
10    <td align="center" style="border:1px ##999999 solid;">
11        <a href="#FlickrContent.rss.channel.item[i].link.xmlText#">
12            #FlickrContent.rss.channel.item[i].title.xmlText#
13        </a><BR><BR>
14        <a href="#FlickrContent.rss.channel.item[i].link.xmlText#">
15            <img src="#FlickrContent.rss.channel.item[i]['media:thumbnail'].xmlattributes.url#" border="0">
16        </a><BR><BR>
17        <small><strong>Uploaded on :</strong> #Dateformat(FlickrContent.rss.channel.item[i].pubDate.xmlText, "dd-mmm-yyyy")#</small>
18    </td>
19    <!--- I want to display only 5 photo per line --->
20    <cfif i MOD 5 EQ 0></tr><tr></cfif>
21</cfloop>
22</table>

Here is my photography on Flickr

Top of Page