shanzap404
shanzap404

Reputation: 17

Efficient way to display an image on .Net Core MVC?

What do you think is the most efficient way to display an image? Right now I'm using the Base64 to display the image. But I'm trying to build a Social Media app(to test my skills) which you can post image like facebook. I think the performance will be bad using my current approach trying to load the posts with images. I'm not storing the images wwwroot.

        postDto.ImageUrl = $"data:image/{Path.GetExtension(postDto.FilePath)};base64,{Convert.ToBase64String(bytes)}";

Upvotes: 0

Views: 238

Answers (1)

ZwiebelTVDE
ZwiebelTVDE

Reputation: 64

I think the industry standard is to deploy a CDN to handle the storage and serving of the images. Any webserver like Nginx and Apache2 should be fine to do this job. You should be able to load the URL of the CDN directly without converting them to base64.

Upvotes: 2

Related Questions