1
我创建了一个将图像文件上传到图像库的Liferay portlet。我已经能够通过IGImageLocalServiceUtil以编程方式从我的Liferay服务器添加和检索图像,但我似乎无法看到控制面板下的图像库portlet中的图像。我怀疑这与许可问题有关。你能帮我找出我的代码中有什么问题吗?谢谢。以编程方式将图像添加到Liferay图像库
long userId = themeDisplay.getUserId();
long groupId = themeDisplay.getLayout().getGroupId();
String newFilename = "test";
long folderId = 0;
String[] permissions = { "VIEW" };
serviceContext.setCommunityPermissions(permissions);
serviceContext.setGuestPermissions(permissions);
igImage = IGImageLocalServiceUtil.addImage(userId, groupId, folderId, newFilename, "", sourceFile, "image/png" ,serviceContext);
IGImageLocalServiceUtil.addImageResources(igImage, serviceContext.getCommunityPermissions(), serviceContext.getGuestPermissions());
请指定您正在使用的Liferay Portal版本。在最新版本的Liferay Portal中,您的代码不会编译。 –
Liferay 6.0.6。为什么这不会编译? – Gian
因为在Liferay Portal 6.1中,“图片库”和“文档库”Portlet都合并为“文档和媒体”Portlet,所以API已更改且IGImageLocalServiceUtil不再存在。但这不是你的问题。 –