Image gallery that works with file assets and documents


The default version of image-gallery.vtl that comes with dotCMS only works with image files of type Document.  If a folder contains image files of type File Asset they won't get picked up.  With this revised version, image files can be of either type.

Also it sorts by filename instead of last update date.


#set($_qk = "+(structureName:Document structureName:FileAsset) +confolder:$!{folder1} +(Document.metaData.contentType:image/* FileAsset.metaData.contentType:image/*)")
#set($cons = $dotcontent.pull(${_qk},$!{numberOfResults},""))

#if ($UtilMethods.isSet($title))
#if($cons.size() > 0)
	<ul class="photo-gallery">
		#foreach($con in $sorter.sort($cons, "fileName"))
				<a class="prettyPhoto" href="/contentAsset/resize-image/$con.identifier/fileAsset" rel="prettyPhoto[x]" title="$!{con.title}" style="background: url(/contentAsset/resize-image/$con.identifier/fileAsset/h/65) no-repeat center center;">
	There are currently no images in the folder.

<div class="clear p4"></div>