I am a little confused as to how I should be handling image files in my project structure.
I have a workspace with a React app folder and a Web Api folder. The web api is for video games, and one of the fields in the model is a string, called image. I.e image: ‘call_of_duty_cover.jpg’ .
The thing is, we just learned how to upload images to web api, where we was taught to uplod into MyWebApi/wwwroot/images
But while doing some research I came across a post here on Stack Overflow from 2017: Where should I store images in my web app?
Typically, you'll store images for your website in a directory called "imgs" underneath your root htdocs or public directory. This is considered the front end; you don't really store images in a backend or DB unless you're storing links to those images and providing those links via an API call.
If you wind up with lots of images, it's common to create more folders under that "imgs" directory, say one for each page or for one for each feature, but that's usually where images are kept.
So Im just confused as to why my lecturer would recommend using the wwwroot/images/ as source folder for imagefiles references with links in webapi?
And how would you guys recommend doing this? Thx
Edit: To clarify, the lecture I had the other day about image uploads was about how to upload images to webapi/wwwroot/images folder though React frontend— this is NOT what im asking today, I’m wondering in general where the image files that I reference in the webapi should be stored :) currently I have all the image files in the react project, under public/images/ :)
Edit 2: So the project is to create a web api and database for different video games. And use react to make an interactive solution where one can play around with, I was thinking of doing a quiz thing. In the quiz, for every question I will need to fetch an image or an image link from the webapi to display the image. So I assume I store it somewhere in the folder structure and store strings of matching paths/filenames to fetch the images that way.
I will probably store 50+ games in the database :)