๐Ÿš€ Todayโ€™s feature added to my ๐—๐—ผ๐—ฏ ๐—”๐—ฝ๐—ฝ๐—น๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ง๐—ฟ๐—ฎ๐—ฐ๐—ธ๐—ฒ๐—ฟ project:

๐Ÿ“ธ ๐—ฃ๐—ฟ๐—ผ๐—ณ๐—ถ๐—น๐—ฒ ๐—œ๐—บ๐—ฎ๐—ด๐—ฒ ๐—จ๐—ฝ๐—น๐—ผ๐—ฎ๐—ฑ + ๐——๐—ถ๐˜€๐—ฝ๐—น๐—ฎ๐˜† ๐˜„๐—ถ๐˜๐—ต ๐—™๐—ฎ๐—น๐—น๐—ฏ๐—ฎ๐—ฐ๐—ธ ๐—œ๐—ป๐—ถ๐˜๐—ถ๐—ฎ๐—น๐˜€!

๐Ÿ‘ฃ ๐—ฆ๐˜๐—ฒ๐—ฝ๐˜€ ๐—œ ๐—ณ๐—ผ๐—น๐—น๐—ผ๐˜„๐—ฒ๐—ฑ:

  1. If a user uploads an image, save it in wwwroot/images/ and store the path in ProfilePicImagePath.

  2. On login, display it using:

Avatar

  1. If no image is provided, generate a ๐—ฑ๐˜†๐—ป๐—ฎ๐—บ๐—ถ๐—ฐ ๐—ถ๐—บ๐—ฎ๐—ด๐—ฒ ๐˜„๐—ถ๐˜๐—ต ๐—ถ๐—ป๐—ถ๐˜๐—ถ๐—ฎ๐—น๐˜€ (like "MC" for ๐— ๐—ผ๐˜‚๐—ป๐—ถ๐—ธ๐—ฎ ๐—–๐—›) using the full name. I used a fallback logic that:
    • Extracts initials from the name
    • Renders them onto a colored background using System.Drawing or ImageSharp
    • Saves the generated image and serves it in place of missing photos

๐Ÿง  ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฝ๐—ฟ๐—ฒ๐—ณ๐—ฒ๐—ฟ ๐˜๐—ผ ๐—ต๐—ฎ๐—ป๐—ฑ๐—น๐—ฒ ๐—ฑ๐—ฒ๐—ณ๐—ฎ๐˜‚๐—น๐˜ ๐—ฝ๐—ฟ๐—ผ๐—ณ๐—ถ๐—น๐—ฒ ๐—ถ๐—บ๐—ฎ๐—ด๐—ฒ๐˜€ โ€” ๐—ด๐—ฒ๐—ป๐—ฒ๐—ฟ๐—ฎ๐˜๐—ฒ๐—ฑ ๐—ถ๐—ป๐—ถ๐˜๐—ถ๐—ฎ๐—น๐˜€ ๐—ผ๐—ฟ ๐—ด๐—ฒ๐—ป๐—ฒ๐—ฟ๐—ถ๐—ฐ ๐—ฎ๐˜ƒ๐—ฎ๐˜๐—ฎ๐—ฟ๐˜€?