The following sample code show how to get the journal article small thumbnail display.
If you write the code like this, the liferay will not render the image for your.
-
-
<c:forEach items="${list}" var="journal">
-
${journal.title}
-
< img src="${journal.smallImageURL}" />
-
</c:forEach>
-
Solution :
Step 1) Remember import the require libraries
-
-
<%@ page import="java.util.*" %>
-
<%@ page import="com.liferay.portlet.journal.model.JournalArticle" %>
-
<%@ page import="com.liferay.portal.theme.ThemeDisplay" %>
-
<%@ page import="com.liferay.portal.kernel.util.WebKeys" %>
-
<%@ page import="com.liferay.portal.kernel.servlet.ImageServletTokenUtil" %>
-
Step 2)
-
-
<%
-
List<JournalArticle> list = (List<JournalArticle>)request.getAttribute("list");
-
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
-
-
for (int i = 0; i < list.size(); i++)
-
{
-
JournalArticle journal = (JournalArticle)list.get(i);
-
%>
-
-
<%= journal.getTitle() %>
-
<img src="<%= themeDisplay.getPathImage()%>/image_gallery?img_id=<%= journal.getSmallImageId() %>&t=
-
<%= ImageServletTokenUtil.getToken(journal.getSmallImageId()) %>" width="100" height="100"/>
-
<%
-
}
-
%>
-

Posted in 


