Foros de discusión

User portrait image in journal template

thumbnail
Syed Nasar, modificado hace 7 años.

User portrait image in journal template

Junior Member Mensajes: 64 Fecha de incorporación: 3/09/15 Mensajes recientes
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 hace 7 años.

RE: User portrait image in journal template

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
That whole thing just seems wrong. The user model object has a getPortraitURL() method that just takes your themeDisplay object.
thumbnail
Syed Nasar, modificado hace 7 años.

RE: User portrait image in journal template

Junior Member Mensajes: 64 Fecha de incorporación: 3/09/15 Mensajes recientes
How can I get themeDisplay object in template?
Gautam Sharma, modificado hace 7 años.

RE: User portrait image in journal template

Junior Member Mensajes: 92 Fecha de incorporación: 30/04/12 Mensajes recientes
I think we don't have access to themeDisplay in webcontent templates

Please follow below link
Access Objects from Velocity