Forums de discussion

User portrait image in journal template

thumbnail
Syed Nasar, modifié il y a 7 années.

User portrait image in journal template

Junior Member Publications: 64 Date d'inscription: 03/09/15 Publications récentes
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, modifié il y a 7 années.

RE: User portrait image in journal template

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
That whole thing just seems wrong. The user model object has a getPortraitURL() method that just takes your themeDisplay object.
thumbnail
Syed Nasar, modifié il y a 7 années.

RE: User portrait image in journal template

Junior Member Publications: 64 Date d'inscription: 03/09/15 Publications récentes
How can I get themeDisplay object in template?
Gautam Sharma, modifié il y a 7 années.

RE: User portrait image in journal template

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
I think we don't have access to themeDisplay in webcontent templates

Please follow below link
Access Objects from Velocity