๐ Todayโs feature added to my ๐๐ผ๐ฏ ๐๐ฝ๐ฝ๐น๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป ๐ง๐ฟ๐ฎ๐ฐ๐ธ๐ฒ๐ฟ project:
๐ธ ๐ฃ๐ฟ๐ผ๐ณ๐ถ๐น๐ฒ ๐๐บ๐ฎ๐ด๐ฒ ๐จ๐ฝ๐น๐ผ๐ฎ๐ฑ + ๐๐ถ๐๐ฝ๐น๐ฎ๐ ๐๐ถ๐๐ต ๐๐ฎ๐น๐น๐ฏ๐ฎ๐ฐ๐ธ ๐๐ป๐ถ๐๐ถ๐ฎ๐น๐!
๐ฃ ๐ฆ๐๐ฒ๐ฝ๐ ๐ ๐ณ๐ผ๐น๐น๐ผ๐๐ฒ๐ฑ:
If a user uploads an image, save it in
wwwroot/images/
and store the path inProfilePicImagePath
.On login, display it using:
- 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
orImageSharp
- Saves the generated image and serves it in place of missing photos
๐ง ๐๐ผ๐ ๐ฑ๐ผ ๐๐ผ๐ ๐ฝ๐ฟ๐ฒ๐ณ๐ฒ๐ฟ ๐๐ผ ๐ต๐ฎ๐ป๐ฑ๐น๐ฒ ๐ฑ๐ฒ๐ณ๐ฎ๐๐น๐ ๐ฝ๐ฟ๐ผ๐ณ๐ถ๐น๐ฒ ๐ถ๐บ๐ฎ๐ด๐ฒ๐ โ ๐ด๐ฒ๐ป๐ฒ๐ฟ๐ฎ๐๐ฒ๐ฑ ๐ถ๐ป๐ถ๐๐ถ๐ฎ๐น๐ ๐ผ๐ฟ ๐ด๐ฒ๐ป๐ฒ๐ฟ๐ถ๐ฐ ๐ฎ๐๐ฎ๐๐ฎ๐ฟ๐?