Displaying a sets images from Flickr with CFlickr
In the last part we looked at how to pull out a specific users sets from Flickr using the CFlickr API.
This episode looks at using that set id to display the images within.
First we start off with starting up the CFlickr Object and loading the PhotosetsInterface
<cfset flickr.init("yourAPIkey")>
<!--- Get the interface we want to work with --->
<cfset setInterface = flickr.getPhotosetsInterface()>
Following on from my last post about displaying the sets, we are passing the set id in through the URL.s variable. So lets get the array of photos in the set, and some info on the set itself.
<cfset arrayPhotos = photoList.getPhotos()>
<cfset setInfo = setInterface.getInfo(photoset_id=#url.s#)>
Display the title of the set to the user
Lets loop over the array of photos, and save the title for future use.
<cfset photo = arrayPhotos[i]>
<cfset title = photo.getTitle()>
...
</cfloop>
I am using the small square photo, just as in the sets display, that Flickr produces for every photo, it just provides a nicer layout.
And wrapping a link around that
Completed code (c'mon that was pretty easy right?):
<cfset arrayPhotos = photoList.getPhotos()>
<cfset setInfo = setInterface.getInfo(photoset_id=#url.s#)>
<cfoutput>
<h1>#setInfo.getTitle()# (#setInfo.getTotal()#)</h1>
<table id="photoTable">
<tr>
<cfloop from="1" to="#arraylen(arrayPhotos)#" index="i">
<cfset photo = arrayPhotos[i]>
<cfset title = photo.getTitle()>
<td width="12%">
<div class="menuBody" style="text-align:center;">
<a href="#photo.getPhotoUrl()#" title="#htmlEditFormat(title)#">
<img src="#photo.getPhotoUrl(photo.SIZE_SMALL_SQUARE)#" border="0" alt="#title#"/>
</a>
</div>
</td><cfif i mod 7 eq 0></tr><tr></cfif>
</cfloop>
</tr>
</table>


how to show our photos only. I want to fetch the comments altogether and the
tags too. Could guide me?