Domanda

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.

È stato utile?

Soluzione

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);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top