Beispiel #1
0
        public byte[] GetCustomerAvatar(int customerID, AvatarType type, bool cache = true)
        {
            var bytes = new byte[0];


            // Try to return the image found at the avatar path
            bytes = GlobalUtilities.GetExternalImageBytes(GlobalUtilities.GetCustomerAvatarUrl(customerID, type, cache));


            // If we didn't find anything there, convert the default image (which is Base64) to a byte array.
            // We'll use that instead
            if (bytes == null || bytes.Length == 0)
            {
                Exigo.Images().SetCustomerAvatar(customerID, Convert.FromBase64String(GlobalSettings.Avatars.DefaultAvatarAsBase64));
                return(GetCustomerAvatar(customerID, type, cache));
            }

            return(bytes);
        }