Skip to content

Instantly share code, notes, and snippets.

@neokoenig

neokoenig/flickr.cfm

Created Sep 28, 2016
Embed
What would you like to do?
<!---Flickr Params--->
<cfparam name="flickr.url" default="https://api.flickr.com/services/rest/" />
<cfparam name="flickr.key" default="YOURFLICKRKEY" />
<cfparam name="flickr.userid" default="123456789@N03">
<cfparam name="flickr.xml" default="">
<!---Send my Request to Flickr: this will get an XML doc with all my public photosets--->
<cfhttp url="#flickr.url#">
<cfhttpparam name="api_key" type="url" value="#flickr.key#" />
<cfhttpparam name="method" type="url" value="flickr.photosets.getList" />
<cfhttpparam name="user_id" type="url" value="#flickr.userid#" />
<cfhttpparam name="per_page" type="url" value="15" />
</cfhttp>
<cfscript>
flickr.xml = XmlParse(CFHTTP.FileContent);
photosets=XMLSearch(flickr.xml, '/rsp/photosets/photoset');
pq=queryNew("title,link,source,description");
i=1;
for(set in photosets){
queryAddRow(pq);
querySetCell(pq, "title", photosets[i].title.xmltext, i);
querySetCell(pq, "link", "http://www.flickr.com/photos/#flickr.userid#/sets/#photosets[i].XmlAttributes['id']#/", i);
querySetCell(pq, "source", "http://farm#photosets[i].XmlAttributes['farm']#.static.flickr.com/#photosets[i].XmlAttributes['server']#/#photosets[i].XmlAttributes['primary']#_#photosets[i].XmlAttributes['secret']#_q.jpg", i);
querySetCell(pq, "description", photosets[i].description.xmltext , i);
i++;
}
writeDump(pq);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment