Skip to content

Instantly share code, notes, and snippets.

@mattlevine
Created February 18, 2012 16:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattlevine/1860076 to your computer and use it in GitHub Desktop.
Save mattlevine/1860076 to your computer and use it in GitHub Desktop.
How to get images that match the current content nodes categories
<cfscript>
//Get current content's category assignments
rsCategories=$.content().getCategoriesQuery();
//Build a feed of images with matching categories
images=$.getBean("feed")
.setCategoryID( valueList(rsCategories.categoryID) )
.addParam(field='tcontent.type',condition="EQ",criteria='File')
.addParam(field='tfiles.fileEXT',condition="in",criteria='jpg,png,gif,jpeg')
.getIterator();
</cfscript>
<!--- Output return images--->
<cfoutput>
<cfloop condition="images.hasNext()">
<img src="#images.next().getImageURL(size='small')#"/><br/>
</cfloop>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment