25 July, 2012

Get Image From Image Gallery

You can re-use below code to get image from image gallery and can use in any of your portlet.


private IGImage getImage(IGFolder igFolder, String imageName, ThemeDisplay themeDisplay) {
        IGImage igImage = null;
        if (igFolder != null) {
            try {
                List imgList = IGImageLocalServiceUtil.getImages(themeDisplay.getScopeGroupId(), igFolder.getFolderId());

                for (IGImage igImg : imgList) {
                    if (imageName.equalsIgnoreCase(igImg.getName())) {
                        igImage = igImg;
                        break;
                    }
                }

            } catch (Exception e) {
             System.out.println(e.getMessage());
            }
        }
        return igImage;
    }

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...