This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. Image Gallery Thumbnails
Thumbnails are reduced-size versions of pictures, used to help in recognizing and organizing them, serving the same role for images as a normal text index does for words (source: http://en.wikipedia.org/wiki/Thumbnail).
Liferay's Image Gallery Portlet automatically creates thumbnails for images when they are upload. This article describes how the creation of this thumbnails can be configured and how thumbnails can be accessed programmatically.
Table of Contents [-]
Configuration #
This can be configured through portal.properties.
# Set the maximum thumbnail height and width in pixels. Set dimension of the
# custom images to 0 to disable creating a scaled image of that size.
#
ig.image.thumbnail.max.dimension=150
#ig.image.custom1.max.dimension=100
#ig.image.custom2.max.dimension=0As seen above, ig.image.thumbnail.max.dimension defines the max dimension of the thumbnail. In addition, another 2 thumbnail with different custom sizes can be created: custom1 and custom2.
Accessing programmatically #
In order to use the thumbnails in jsp files, you should do the following:
IGImage image = ....; Image largeImage = ImageLocalServiceUtil.getImage(image.getLargeImageId()); Image smallImage = ImageLocalServiceUtil.getImage(image.getSmallImageId()); Image custom1Image = ImageLocalServiceUtil.getImage(image.getCustom1ImageId()); Image custom2Image = ImageLocalServiceUtil.getImage(image.getCustom2ImageId())