Liferay 6.2如何显示存储在文档和媒体中的图像

时间:2016-04-26 11:41:16

标签: liferay liferay-6

我想知道在自定义portlet的jsp中显示DLFileEntry图像的所有可能方法。 更具体地说,我目前使用以下方式,但我有一些DLFileEntry对象的问题,'bigimageid'的值为零

DLFileEntry image = DLFileEntryLocalServiceUtil.getFileEntry(long_id);
String imageUrl = themeDisplay.getPathImage() + "/image_gallery?img_id=" + image.getLargeImageId() +  "&t=" + WebServerServletTokenUtil.getToken(image.getLargeImageId());

在不使用大图像ID的情况下获取图像网址的替代方法是什么?

2 个答案:

答案 0 :(得分:5)

以下是类似于Liferay 文档和媒体 portlet使用的模式:

DLFileEntry image = DLFileEntryLocalServiceUtil.getFileEntry(long_id);
String imageUrl = "";
if (image != null) {
    imageUrl =
        PortalUtil.getPortalURL(request) + "/documents/" + image.getGroupId() + "/" +
            image.getFolderId() + "/" + image.getTitle() + "/" + image.getUuid() + "?t=" +
            System.currentTimeMillis();
}

PortalUtil.getPortalURL(request)将根据httpServletRequest返回您门户网站的基本网址,System.currentTimeMillis()将为您提供当前时间(毫秒),其余参数均可通过{{ 1}}对象。

答案 1 :(得分:0)

我认为这可以帮到你

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
    <tr class="clickablerow" data-url="link.html">
        <td>Some Text Value <input type="button" value="Submit" onclick="otherFunction()"></td>
    </tr>
    <tr class="clickablerow" data-url="link2.html">
        <td>Some Text Value <input type="button" value="Submit" onclick="otherFunction()"></td>
    </tr>
    <tr class="clickablerow" data-url="link3.html">
        <td>Some Text Value <input type="button" value="Submit" onclick="otherFunction()"></td>
    </tr>
</table>

问候!

相关问题