留言板

User portrait image in journal template

thumbnail
Syed Nasar,修改在7 年前。

User portrait image in journal template

Junior Member 帖子: 64 加入日期: 15-9-3 最近的帖子
Hi,
I need to display user portrait image in web content. So In template I have written following code. But Its not working.

#set ($DigesterUtil = $portal.getClass().forName("com.liferay.portal.kernel.util.DigesterUtil"))
       #set ($profilePicUrl = $profilePicUrl + "_portrait?img_id=")
        #set ($profilePicUrl = $profilePicUrl + $usuario.getPortraitId())


        #set ($profilePicUrl = $tD.get("path-image") + "/user_")
        #if ($user.isFemale())
          #set ($profilePicUrl = $profilePicUrl + "female")
        #else
          #set ($profilePicUrl = $profilePicUrl + "male")
        #end

        #set ($profilePicUrl = $profilePicUrl + "_portrait?img_id=")
        #set ($profilePicUrl = $profilePicUrl + $user.getPortraitId())

        #set ($profilePicUrl = $profilePicUrl + "&img_id_token=")
        #set ($profilePicUrl = $profilePicUrl + $httpUtil.encodeURL($DigesterUtil.digest($user.getUuid())))

        <div class="img_user">          
            <img src="$profilePicUrl">
        </div>


as given in stack overflow.
Can anyone please solve it?
thumbnail
David H Nebinger,修改在7 年前。

RE: User portrait image in journal template

Liferay Legend 帖子: 14918 加入日期: 06-9-2 最近的帖子
That whole thing just seems wrong. The user model object has a getPortraitURL() method that just takes your themeDisplay object.
thumbnail
Syed Nasar,修改在7 年前。

RE: User portrait image in journal template

Junior Member 帖子: 64 加入日期: 15-9-3 最近的帖子
How can I get themeDisplay object in template?
Gautam Sharma,修改在7 年前。

RE: User portrait image in journal template

Junior Member 帖子: 92 加入日期: 12-4-30 最近的帖子
I think we don't have access to themeDisplay in webcontent templates

Please follow below link
Access Objects from Velocity