如何在Liferay中检索用户个人资料图片 [英] How to retrieve a user profile picture in Liferay

查看:147
本文介绍了如何在Liferay中检索用户个人资料图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检索用户个人资料图片。我该怎么做?你能分享一下代码片段吗?我正在使用Liferay 6.0.6。它只有user.getPortraitId()而没有user.getPortraitURL()。所以一旦我在JAVA课程中获得了肖像ID,我该怎么办呢?

I want to retrieve a user profile picture. How do i do it? Could you please share a code snippet? Im using Liferay 6.0.6. It has only user.getPortraitId() and no user.getPortraitURL(). So once i get the portrait id inside a JAVA class, what do i do with it?

推荐答案

查看<$的实现c $ c> UserConstants.getPortraitURL(...)
https://github.com/liferay/liferay-portal/blob/master/portal-service/src/com/liferay/portal/ model / UserConstants.java

在这种方法中你可以获得图片网址。

On this approach you can get the image url.

如果你需要图片对象,你可以用 ImageLocalServiceUtil 加载它:

If you need the image object, you can load it with ImageLocalServiceUtil:

        long portraitId = user.getPortraitId();
        Image image = ImageLocalServiceUtil.getImage(portraitId);

这篇关于如何在Liferay中检索用户个人资料图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆