Wednesday, 24 April 2013

getting images from document and media folder using structure and template

Finally i succeed to get images from document and media folder and this is code for that

#set ($DLAppServiceUtil = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLAppService"))
#set ($symbolsFolder = $DLAppServiceUtil.getFolder($getterUtil.getLong($groupId),0,"$foldername.getData()"))
#set($gid = $getterUtil.getLong($request.get("theme-display").get("scope-group-id")))

#if($symbolsFolder)
#set ($symbolImages = $DLAppServiceUtil.getFileEntries($getterUtil.getLong($symbolsFolder.getRepositoryId()),$getterUtil.getLong($symbolsFolder.getFolderId())))
<div id="gallery1" class="gallery" style="width:$w;">
#foreach( $symbol in $symbolImages )
<ul> 
#set ($dlService = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService"))
#set ($dlfile = $dlService.getFileEntryByUuidAndGroupId($symbol.getUuid(),$gid))
#set ($filename = $dlfile.getName())



<a href="/documents/$symbolsFolder.getRepositoryId()/$getterUtil.getLong($symbolsFolder.getFolderId())/$dlfile.getName()/$symbol.getUuid()">
<li >
<img class="picture" src="/documents/$symbolsFolder.getRepositoryId()/$getterUtil.getLong($symbolsFolder.getFolderId())/$dlfile.getName()/$symbol.getUuid()""/>
</li > </a> 
<li class="imgtitle">
</li>

</ul>

#end
</div>
#else
No images in folder "$foldername.getData()"
#end

1 comment: