Forum Discussion

jaikumar1's avatar
jaikumar1
Mentor
7 years ago

How to define and get user defined height and width of the avatar image

Hi,

i just looking for the avatar image, which needs to be display on user specified height and width and not for the default height and width of the system defined. So please let me know if any other API can help?

  • jaikumar1 You might wanna have a look at this: https://lithosphere.lithium.com/t5/Developer-Discussion/Show-core-avatars-larger-on-messages/m-p/205629#M9320

    Controlling the size of the avatars is not something the API does (or should!), it is done via some pretty undocumented URL path trickery, e.g. look at a random avatar I picked from the Lithosphere:

    https://lithosphere.i.lithium.com/t5/image/serverpage/avatar-name/oldgaming/avatar-theme/2delicious/avatar-collection/technology/avatar-display-size/profile

    notice the end of the URL, the variations I do know about are:

    .../avatar-display-size/message -> small
    .../avatar-display-size/profile -> medium
    .../avatar-display-size/unspecified -> larger

    there might be more or there might be documentation about it that I do not know about =), but that's all I know about avatar sizes =D...

    • Hi luk

      Thank you for your response. I have checked the option, and not sure the following code can update based on your suggestion. 

      <#assign avatar_info = restadmin("/users/id/"+login_user_id+ "/profiles/avatar").image />          
      <img class="lia-user-rank-icon-left" title="${login_user_info.user.login}" alt="${login_user_info.user.login}" src="${avatar_info.url}" height="63" width="63" /> 
      • luk's avatar
        luk
        Boss

        jaikumar1 what is the output of 

        ${avatar_info.url}

        would be easier to tell based on that, but I also see you're setting

        height="63" width="63"

        attributes, which of course have nothing to do with the original avatar size but force these dimensions onto the image. If the avatars are square you shouldn't have much problems, but if they are not, you gonna have squished images (e.g. not resized proportially). Based off these dimensions I would go for the /profile size (see link above), but I do not know the exact dimensions this sizes the avatars, my guess would be the long side is resized to 128px, so that should be enough, the /message size looks like long side = 50px, so that would be a bit too small...