Question

I have uploaded some images and documents in document and media portet of Liferay I want to get the Thumbnail of that Images.

Folder = DLAppServiceUtil.getFolder(repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID); java.util.List l; l = DLAppServiceUtil.getFileEntries(repositoryId,projectsFolder.getFolderId());

        for(FileEntry f:l)
        {
            JsonObject obj=new JsonObject();
            InputStream is=f.getContentStream();


        }

From above code i can get the normal stream of Images but i want to get the thumbnail stream.Is is possible??? Any help will be greatly appreciated.

Was it helpful?

Solution

Taking your snippet into consideration

import com.liferay.portlet.documentlibrary.util.ImageProcessorUtil;
import com.liferay.portlet.documentlibrary.util.DLPreviewableProcessor;

for(FileEntry f:l) {
  InputStream thumbnail = ImageProcessorUtil.getThumbnailAsStream(f.getFileVersion(), DLPreviewableProcessor.THUMBNAIL_INDEX_DEFAULT);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top