I think this can help you
<%@ page import="com.liferay.portlet.documentlibrary.model.DLFolder" %>
<%@ page import="com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil" %>
<%@ page import="com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil" %>
<%@ page import="com.liferay.portlet.documentlibrary.model.DLFileEntry" %>
<%@ page import="java.util.List" %>
<%@ page import="com.liferay.portlet.imagegallery.service.IGImageLocalServiceUtil" %>
<%@ page import="com.liferay.portlet.imagegallery.model.IGImage" %>
<%@ include file="init.jsp" %>
<%
String igFolderId = portletPreferences.getValue("igFolderId", "0");
String cycleSpeed = portletPreferences.getValue("cycleSpeed", "1000");
String fxSpeed = portletPreferences.getValue("fxSpeed", "1000");
String type = portletPreferences.getValue("type", "fade");
String height = portletPreferences.getValue("height", "480");
String width = portletPreferences.getValue("width", "640");
List<IGImage> images = IGImageLocalServiceUtil.getImages(Long.valueOf(igFolderId));
%>
<c:choose>
<c:when test="<%= Long.valueOf(igFolderId) != 0%>">
<div id="<portlet:namespace />images">
<%
for (int i = 0; i < images.size(); i++) {
IGImage image = images.get(i);
%>
<img width="<%= width %>" height="<%= height %>" src="/image/image_gallery?img_id=<%=image.getLargeImageId()%>" alt="<%=image.getDescription()%>" <%= i == 0 ? "" : "style=\"display:none;\""%>/>
<%
}
%>
</div>
</c:when>
<c:otherwise>
<span class="portlet-msg-info">
Please configure this portlet.
</span>
</c:otherwise>
</c:choose>
<script type="text/javascript">
jQuery(
function() {
jQuery("#<portlet:namespace />images").cycle({
fx: '<%= type %>',
speed: <%= fxSpeed %>,
timeout: <%= cycleSpeed %>
});
}
);
</script>
Greetings!