Storing multiple Image in the directory and database - sql

I'm making a small ecommerce project using Reactjs and SQL. I'm storing two different images shop(1) and user report(2)
I'm wondering if it's a good idea if I store the shop images in the directory itself like this
./public
./images
./shop
image1.png
image2.png
index.html
While the user report gets uploaded in the SQL as a blob

If the shop images are only used as static resources for your app, your example is the common way to do it.
However, if the shop images can be added/edited by users or if they shouldn't be visible to everyone, then you should store them in the database similar to the user report images.

Related

How to integrate images folder hierarchical with CSV file?

Probably I could not ask the question in a proper way. But Here is what I want to do.
I have folders in hierarchical manner. Folders within folders. (For example - I am working on a DL project. I have images of blades of a image. Every fan is in one separate room of a house. House has many rooms hence we have assign number to these fans. A Fan has room number, A Blade of fan has three sides. We have assign some characters to these sides of blade also. like this we have images of blade and folders is something like this.
House - Room - Blade side
Now I want to build a front end which has these tabs(House name, room number, blade side etc) on web page . And I want to use local system's or azure storage drive to store the huge image dataset. But I want to use SQL database to store the information (like sides of the blade, room number, fan number etc) in csv format. And use this SQL as backend database for the web page.
When a user enters just any one of these information in the tab on webpage. I want this to give image as output
How to do this?
Thank you very much in advance.

Persistent volume for wwwroot/storage folder of Asp.ner Core App

I have a middle size asp.net core application (online store). One of the functions is uploading pictures for products. Also, I want to host my application in Kubernetes in a cloud.
I know that a common solution to this problem is to use some S3-like file storage. But my store quite little and I don't want to complicate it very much.
So I want to use some folder in mySite/wwwroot like mySite/wwwroot/storage to storage all pictures:
It's simple to work with
I can create a simple URL for my pictures like mysite.com/storage/picture.png
Is it somehow possible to map mySite/wwwroot/storage to some persistent volume?
What hostname should I use? It is easy to mount images like Postgres because Postgres use some hardcoded folder to store data (/var/lib/postgresql/data).
I understand that it restricts all replicas of my site only by one node.

The best way to manage images when importing from csv in prestashop

I want to know the best way how to handle/manage our products images when we import products from csv in Prestashop 1.6. I mean, does Prestashop provide place/space to upload many images? or we must upload in external website (what website)?
May be this question is general enough, but when I googling I dont get the clear answer. Your answers I appreciate.
Newer PrestaShop versions support new storage architecture for pictures. This new system of image placement allows to work with images much faster, keeping them in order. Images are stored at /img/p folder, in created subfolders that correspond to image ID
Basically, you will avoid having 100,000 pictures in the same “/img/p” folder. Instead, the pictures will be placed into subfolders within “/img/p” directory (e.g.: “/img/p/1/2/ for image with ID 12 or /img/p/7/6/5/4/7 for image with ID 76547).

File permissions on a web server?

I'm new at writing code for websites. The website allows users to upload files, such as profile pictures or other pictures. The files are saved in the unix file system and the URLs to find those images are stored in a MySQL database.
It seems like the only way I can let the user upload files is to give write access to anybody using chmod. Otherwise it complains that it doesn't have write permissions. But they shouldn't be able to write whatever they want or overwrite other users stuff. Similarly, to allow users to see images that they have rightful access to, they need read permissions on the file system. But now that means that anybody with the url to that picture can see the image too, correct? That's not what I want.
Is there a solution to this contradiction? Or am I thinking about the problem incorrectly? Thanks for any help.
You need to manage the permissions in your application and not expose arbitrary parts of your local filesystem directly to the clients. Your application should decide what files someone can see or where to write data. You should not trust data (filenames, etc) from your clients...ideally, store files on disk using systematically generated names and store human-readable names in the database.
SunStar9,
Since you are already using a MySQL database to store the URL of the image on the file system, why not just store the image itself as a BLOB (binary large object)?
This is generally a well-accepted design practice for allowing users to upload binary data to a website.
Are you using PHP, Java, Ruby/Rails, or something other to develop your website? Depending on what you are using, there could be file upload/management plugins or modules that will help you develop what you are trying to do if you are certain you want to use the files ystem for storing the image data.

Is storing Image File in database good in desktop application running in network?

I recently came across a problem for image file storage in network.
I have developed a desktop application. It runs in network. It has central database system. Users log in from their own computer in the network and do their job.
Till now the database actions are going fine no problem. Users shares data from same database server.
Now i am being asked to save the user[operator]'s photo too. I am getting confused whether to save it in database as other data or to store in separate file server.
I would like to know which one is better storing images in database or in file server?
EDIT:
The main purpose is to store the account holder's photo and signature and later show it during transaction so that teller can verify the person and signature is correct or not?
See these:
Storing images in database: Yea or nay?
Should I store my images in the database or folders?
Would you store binary data in database or folders?
Store pictures as files or or the database for a web app?
Storing a small number of images: blob or fs?
User Images: Database or filesystem storage?
Since this is a desktop application it's a bit different.
It's really how much data are we talking about here. If you've only got 100 or so users, and it's only profile pictures, I would store it in the DB for a few practical reasons:
No need to manage or worry about a separate file store
You don't need to give shared folder access to each user
No permissions issues
No chance of people messing up your image store
It will be included in your standard DB backup
It will be nicely linked to your data (no absolute vs. relative path issues)
Of course, if you're going to be storing tons of images for thousands of users, I would go with the file system storage.
I think you have to define what you mean with better.
If it is faster my guess you don't want to use a database. You probably just want it plain on a file server.
If you want something like a mini-facebook, where you need a much more dynamic environment, perhaps you are better of storing it a database.
This is more a question than an answer, what do you want to do with the pictures?