[英]Uploading images to liferay theme from a portlet
我有Liferay Spring Maven portlet和liferay主題。 現在,用戶將通過portlet上傳圖像。 我們如何將其置於/ webapps / theme / images中? 任何內置的liferay功能/ API可以幫助我們將上傳的圖像放入主題中?
對於文件上載功能,您可以參考: 如何在相對目錄中上載文件
對於主題圖像文件夾的動態路徑,您可以通過ThemeDisplay
對象獲取它,如下所示:
行動:
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
String themeImagePath = themeDisplay.getPortalURL() + themeDisplay.getPathImage();
request
可以是renderRequest
或actionRequest
。
JSP:
<liferay-theme:defineObjects />
String themeImagePath = themeDisplay.getPortalURL() + themeDisplay.getPathImage();
其他相對使用的選項是themeDisplay().getPathThemeCss()
, themeDisplay().getPathJavaScript()
或themeDisplay().getPathMain()
;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.