String imageUrl="/documents/38006/0/coupons7.png/b740c61d-348d-e4f1-e8d5-d2b0a9aea93e?t=1504851883150";
String originalFileName = imageUrl.substring(imageUrl.indexOf("/0/") + 3, imageUrl.lastIndexOf("/"));
long groupId=Long.valueOf(imageUrl.substring(imageUrl.indexOf("/documents/")+11, imageUrl.indexOf("/0/")));
_log.info("groupId###########"+groupId);
FileEntry fileEntry = FileEntryUtil.fetchByR_F_FN(groupId, 0, originalFileName);
InputStream tempImageStream = fileEntry.getContentStream();
ImageBag imageBag = ImageToolUtil.read(tempImageStream);
RenderedImage renderedImage = imageBag.getRenderedImage();
byte[] bytes = ImageToolUtil.getBytes(renderedImage, imageBag.getType());
FileUtil.write(file, bytes);
liferay获取媒体库图片
最新推荐文章于 2018-04-26 11:58:00 发布