Skip to content

Instantly share code, notes, and snippets.

@65
Created March 11, 2012 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 65/2015469 to your computer and use it in GitHub Desktop.
Save 65/2015469 to your computer and use it in GitHub Desktop.
BlogCFC Flickr Images Pod
<cfsetting enablecfoutputonly=true>
<cfprocessingdirective pageencoding="utf-8">
<cfmodule template="../../tags/scopecache.cfm" cachename="pod_images" scope="application" timeout="#application.timeout#">
<cfmodule template="../../tags/podlayout.cfm" title="Recent Flickr">
<cfoutput>
</cfoutput>
</cfmodule>
</cfmodule>
<cfsetting enablecfoutputonly=false>
<cfinclude template="../includes/pods/images.cfm">
<div style="text-align:center;">
<!--- Loop over the photos and output a thumbnail of each --->
<cfloop from="1" to="#arraylen(arrayPhotos)#" index="i">
<cfset photo = arrayPhotos[i]>
<a href="http://www.flickr.com/photos/length" title="#photo.getTitle()#"><img src="#photo.getPhotoUrl(photo.SIZE_SMALL_SQUARE)#" border="0" alt="#photo.getTitle()#"/></a>
</cfloop>
<a href="http://www.flickr.com/photos/length">More from Length @ Flickr</a>
</div>
<!-- Create an instance of the Flickr class--->
<cfset flickr = createobject("component", "CFlickr.Flickr")>
<!--- change to use your API key --->
<cfset flickr.init("123456789123456789")>
<!--- Get the interface we want to work with --->
<cfset usrInterface = flickr.getPeopleInterface()>
<!--- Find the nsid for the user length --->
<cfset nsid = usrInterface.findByUsername("length").getID()>
<!--- Get the 4 most recent photos --->
<cfset photoList = usrInterface.getPublicPhotos(user_id=nsid,per_page=4,page=1)>
<cfset arrayPhotos = photoList.getPhotos()>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment