如何在 Liferay 中通过 portlet 首选项视图存储上传的图像
我将在 Liferay 中开发横幅旋转器 porlet,它将具有首选项视图(配置视图),管理员可以在其中管理横幅旋转图像,从计算机上传它们并设置其标题和描述。
我的问题是,我应该在哪里存储上传的图像及其信息?我的横幅旋转器 portlet 最初是空的。我希望图像与 liferay 门户相关,而不是与 portlet 本身相关。我应该遵循预定义的 liferay 记录方式吗?
简而言之,我需要存储图像、图像标题、图像描述
我使用liferay 6.0.5
I'm gonna develope banner rotator porlet in Liferay, that will have preference view (Configuration view), from where admin could manage banner rotate images, uploading them from computer and setting its title and description.
My question is, where should I store uploaded images and its informations? My banner-rotator portlet initially will be empty. I want images be related to liferay portal, not portlet itself. Is there predefined liferay documented way I should follow?
With short words, I need to store images, images title, images description
I use liferay 6.0.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您应该创建代表您的横幅的结构和模板。
您的管理员将使用该结构/模板为每个横幅创建文章。
您的 portlet 将根据您的结构/模板搜索文章,或者您可以使用某些类别(“横幅”?)或使用自定义文章类型进行搜索。
或者更简单的方法是您的管理员应该上传特定的横幅“图片库”的文件夹,并且您的 portlet 仅具有用于输入文件夹 ID 的配置。
Portlet 将简单地迭代该文件夹并使用返回的 IGImage 对象中的数据。
更新:
如果您必须从 portlet 首选项上传图像,而不是使用必填字段创建图像。
使用该数据和上传的图像,使用 liferay 的 api 将其存储在图像库中。
请参阅
IGImage 实例有很多属性,其中有您想要的字段。
I think that you should create structure and template that will represent your banner.
Your admin would create article, for each banner, with that structure/template.
Your portlet would search for articles based on your structure/template, or you could use some category ("banner"?) or use custom article type for searching.
Or even simpler way would be that your admin should upload banners in specific folder of "Image gallery" and your portlet has configuration only for entering folder id.
Portlet would simply iterate over that folder and use data from returned IGImage objects.
UPDATE:
If you must upload images from portlet preferences than create from with required fields.
Using that data and uploaded image use liferay's api to store it in image gallery.
See
IGImage instance has lot of properties among which are fields that you want.