use of com.liferay.portal.model.impl.ImageImpl in project liferay-ide by liferay.
the class WebServerServlet method convertFileEntry.
protected Image convertFileEntry(boolean smallImage, FileEntry fileEntry) throws PortalException, SystemException {
try {
Image image = new ImageImpl();
image.setModifiedDate(fileEntry.getModifiedDate());
InputStream is = null;
if (smallImage) {
is = ImageProcessorUtil.getThumbnailAsStream(fileEntry.getFileVersion(), ImageProcessorImpl.THUMBNAIL_INDEX_DEFAULT);
} else {
is = fileEntry.getContentStream();
}
byte[] bytes = FileUtil.getBytes(is);
image.setTextObj(bytes);
image.setType(fileEntry.getExtension());
return image;
} catch (PortalException pe) {
throw pe;
} catch (SystemException se) {
throw se;
} catch (Exception e) {
throw new SystemException(e);
}
}
Aggregations