I think you are trying to store images in a database and a normal user can see them. I think your problem is how to store images in the database, right? If I'm correct you can store image names instead of imagse like you would store age and name.
For example you can create a folder called images then you store all the images in this folder. When you want retrieve an image you can get the url/a link pointing to the image.
For example when an admin stores an image named "image1.jpg" you can program to store the picture to the image folder and also set the name in your database, then this image has a specific id and a url and when a normal user wants to retrieve the image you should instruct your code to get the id and then the respective url which are stored in your database as a string.
For a reliable handling you can create folders like image_jpg
image_png
, image_gif
and so on. Then progmatically check the image type when the admin uploads photos and store them in the correct folder according to the type. And also you can store id
, type
and name
in your database then check the type and create the full path url according to these parameters when you present them to the user
.....................
id | type |name
0001 | jpg |image1
0002 | gif |image2
.....................
When a normal user wants to see an image all you need is the image name and the path/url. In this example the image url for
0001 is "path/image_jpg/image1."+type
0002 is "path/image_gif/image2."+type
When you know the id you can get the type then it's easy to create the path or url for your image...