Fórum

User portrait image in journal template

thumbnail
Syed Nasar, modificado 7 Anos atrás.

User portrait image in journal template

Junior Member Postagens: 64 Data de Entrada: 03/09/15 Postagens Recentes
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, modificado 7 Anos atrás.

RE: User portrait image in journal template

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
That whole thing just seems wrong. The user model object has a getPortraitURL() method that just takes your themeDisplay object.
thumbnail
Syed Nasar, modificado 7 Anos atrás.

RE: User portrait image in journal template

Junior Member Postagens: 64 Data de Entrada: 03/09/15 Postagens Recentes
How can I get themeDisplay object in template?
Gautam Sharma, modificado 7 Anos atrás.

RE: User portrait image in journal template

Junior Member Postagens: 92 Data de Entrada: 30/04/12 Postagens Recentes
I think we don't have access to themeDisplay in webcontent templates

Please follow below link
Access Objects from Velocity