Forums de discussion

get profile picture from user

Adrian Pol, modifié il y a 7 années.

get profile picture from user

Junior Member Publications: 49 Date d'inscription: 14/03/17 Publications récentes
i have this:

<#assign UserLocalService = serviceLocator.findService("com.liferay.portal.service.UserLocalService")>
<#assign user = UserLocalService.getUserById(27132)>
<#assign portalId = user['portraitId']>
<#assign ImageLocalService = serviceLocator.findService("com.liferay.portal.service.ImageLocalService")>

i can get the user, but i want get the profile picture, i searched that i can use that:
<img src="/image/user_male_portrait?img_id=${user.getPortraitId()}&t=${.now?time}" id="img_user"/>

but dosn't working...

Anymore have something idea please :/ emoticon
Adrian Pol, modifié il y a 7 années.

RE: get profile picture from user

Junior Member Publications: 49 Date d'inscription: 14/03/17 Publications récentes
i'm trying something like this:

${user.getPortraitURL(request['theme-display'])}

but putput this:

Method public java.lang.String com.liferay.portal.model.impl.UserImpl.getPortraitURL(com.liferay.portal.theme.ThemeDisplay) throws com.liferay.portal.kernel.exception.PortalException,com.liferay.portal.kernel.exception.SystemException threw an exception when invoked on
Adrian Pol, modifié il y a 7 années.

RE: get profile picture from user

Junior Member Publications: 49 Date d'inscription: 14/03/17 Publications récentes
Nobody?
thumbnail
Olaf Kock, modifié il y a 7 années.

RE: get profile picture from user

Liferay Legend Publications: 6403 Date d'inscription: 23/09/08 Publications récentes
Adrian Pol:
Nobody?


"isn't working" and "threw an exception when invoked on [and the sentence ends here]" aren't quite good descriptions of your problem. Answering your question requires reproducing it first. If you want to make it easier for people to help you: Please give more details.
thumbnail
saleem khan, modifié il y a 7 années.

RE: get profile picture from user

Junior Member Publications: 71 Date d'inscription: 16/11/13 Publications récentes
Hello Adrian,

Please try the code below
&lt;#assign user_portrait = user.getPortraitURL(themeDisplay)&gt;
thumbnail
Santosh B Biradar, modifié il y a 6 années.

RE: get profile picture from user

Junior Member Publications: 41 Date d'inscription: 04/08/15 Publications récentes
Get profile picture from user and URL formation,
here we go...
User user =null;
user = UserLocalServiceUtil.getUser(userId);
long portraitId = user.getPortraitId();
String tokenId = com.liferay.portal.webserver.WebServerServletTokenUtil.getToken(user.getPortraitId());
profilePath = "/image/user_" + ((user != null) && user.isFemale() ? "female" : "male") + "_portrait?img_id=" + portraitId + "&t=" + tokenId;
///////(Based on requirement we can create our URL formation)
if(user!=null){
return new User(user.getUserId(),user.getFirstName(),user.getLastName(),profilePath);