Beispiel #1
0
        public FileResult Get(string username, string subtext)
        {
            // Convert username to userID
            var client = DevRantClient.Create(new HttpClient());
            var userId = client.GetUserID(username).Result.UserId;

            // Use the userID to retrive the meta information about the avatar
            var userProfile = client.GetUser(userId).Result.Profile;
            var avatar      = userProfile.Avatar;
            // Avatar base url + avatar meta = rendered avatar url
            var avatarPath = $"{this.DevrantAvatarBaseURL}/{avatar.Image}";

            var banner = Banner.Generate(avatarPath, avatar.Background, userProfile.Username, (String.IsNullOrEmpty(subtext) ? userProfile.About : subtext));

            return(base.PhysicalFile(banner, "image/png"));
        }