Displaying avatars in transformations

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

User avatars

 
User avatars can also be displayed in transformations by using the <%# GetUserAvatarImage( ... ) %> method. Here are some examples of how it can be used:

 

The following method returns the image tag of the avatar contained in the AvatarGuid field of the currently transformed user, with a maximum sidesize of 50 px. and Alt tag equal to the user's Nickname or Username. The AvatarGuid field must be accessible for this method to work:

 

<%# GetUserAvatarImage(50, HTMLEncode(GetNotEmpty("UserNickname;UserName"))) %>

 

The following method returns the image tag of the avatar with ID UserAvatarID, of user with ID UserID, with a maximum sidesize of 50 px. and Alt tag equal to the user's Username:

 

<%# GetUserAvatarImage(Eval("UserAvatarID"), Eval("UserID"), 50, Eval("UserName")) %>

 

The following method returns the image tag of the avatar with ID UserAvatarID, of user with ID UserID, with a maximum width of 40 px., maximum height of 45 px. and Alt tag equal to the user's Username:

 

<%# GetUserAvatarImage(Eval("UserAvatarID"), Eval("UserID"), 0, 40, 45, Eval("UserName")) %>

 
Group avatars
 
Group avatars can by displayed using the <%# GetGroupAvatarImage( ... ) %> method. Here are some examples:

 

The following method returns the image tag of the group avatar contained in the AvatarGuid field of the currently transformed group, with a maximum sidesize of 50 px. and Alt tag equal to the group's Display name. The AvatarGuid field must be accessible for this method to work:

 

<%# GetGroupAvatarImage(50, Eval("GroupDisplayName", true)) %>

 

The following method returns the image tag of the group avatar with ID GroupAvatarID, with a maximum sidesize of 50 px. and Alt tag equal to the group's Display name:

 

<%# GetGroupAvatarImage(Eval("GroupAvatarID"), 50, Eval("GroupDisplayName", true)) %>

 

The following method returns the image tag of the group avatar with ID GroupAvatarID, with a maximum width of 40 px., maximum height of 45 px. and Alt tag equal to the group's Display name:

 

<%# GetGroupAvatarImage(Eval("GroupAvatarID"), 0, 40, 45, Eval("GroupDisplayName", true)) %>

 

Image tag

 

The following is an example of an image tag generated by the <%# GetUserAvatarImage( ... ) %> method. As you can see, the method uses the ~/CMSModules/Avatars/CMSPages/GetAvatar.aspx page to get the source image.

 

<img style="border-width: 0px;" alt="Andy" src="/CMSModules/Avatars/CMSPages/GetAvatar.aspx?avatarguid=42f9d97e-b0c8-43a2-8a35-62dfec5ae64a&amp;maxsidesize=50" />

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?displaying_avatars_in_transformations.htm