
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=0
As 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())