Search code examples
liferayfreemarker

Liferay template get profile picture


Hello i'm using Freemarker and i have to get the profile picture of user, i have the object user with the portraitId, but i don't know how get Theme Display for get the path or something... I've tried use this:

src="/image/user_male_portrait?img_id=${user.getPortraitId()}&img_id_token="

But i can't get the token, because i don't know :(

<#assign UserLocalService = serviceLocator.findService("com.liferay.portal.service.UserLocalService")>
<#assign user = UserLocalService.getUserById(27132)>

Someone know how get profile picture in freemarker?


Solution

  • I think the themeDisplay object already exists in liferay freemarker. So you can just call it as is.

    Also the user object also has a method getPortraitUrl() that you can call to get the user's image directly.