Exemple #1
0
        public ActionResult Index(int userId, string name, int width = 0, int height = 0)
        {
            string imagePath = Avatars.GetAvatarImagePath(this.Tenant, userId.ToString(CultureInfo.InvariantCulture));

            if (string.IsNullOrWhiteSpace(imagePath))
            {
                return(this.File(Avatars.FromName(name), "image/png"));
            }

            string mimeType = MimeMapping.GetMimeMapping(imagePath);


            return(this.File(BitmapHelper.ResizeCropExcess(imagePath, width, height), mimeType));
        }