Getting the customer avatar

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 12 años
Hello all,
I am wondering if there is a function that is used to retrieve the customer's avatar imageUrl.
I'm trying to display the customer 's avatar on the homepage. My logic is as follow:

if (customer is logged in )
{
  if (the customer has uploaded an his avatar)
   {
      customerAvatarImage.ImageUrl= GetAvatarUrl();
   }

}

I am wondering if there is a public function to get the customer avatar imageUrl. Please help.
Hace 12 años
Try the following code

var customerAvatar = NopContext.Current.User.Avatar;
if (customerAvatar != null)
{
  int avatarSize = this.SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
  string avatarUrl = this.PictureService.GetPictureUrl(customerAvatar, avatarSize, false);}
}
Hace 12 años
Thanks very much for your help!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.