Reputation: 51
I have to manage many photo of user's cooking recipes, profile picture etc...
At the moment I'm working on the website using a local XAMPP server: the image are storage into a folder on the directory of the project and the referenced link is insert with SQL into the DB. When needed, I do a query to obtained the URL of the photo.
If, in the future, I decide to buy a web hosting, where I can save the user's image that they upload?
Upvotes: 4
Views: 107
Reputation: 5894
As said in comment, if you take a "real hosting" (not a packed "wordpress solution") it'll be the same as your local development machine.
You'll have :
/www/
you can access through FTP (sometime SSH),Pictures are usually big, so how can I guess the size I'll need to store them ?
You're not the first one who have to store user picture : think of Facebook, Reddit and lot of other services.
The key point is they don't store pictures "as it", they use two factor to keep the size under control :
For the first point, a 2'000px is already around a 4K display height (~2,2Kpx). For web purpose, 500px was used since age, but as screen got better, the 1Kpx and 2Kpx height seem to be the standard. Chose what fit your use.
For the second, you probably know PNG
and JPG
format. The first is a "lossless" compression and the second is a "lossy" one. This mean if you want to save space, you'll have to trade off quality of your picture, and go for a more or less compressed JPG.
After these, you should be under 500Ko per picture, so for your use case about recipes, that mean at least 2'000 recipes with a picture each before reaching the 1Go milestone...
Sometime you may hear of "storing picture in database". It's an other solution than keeping a name or id-based path to a storage folder for your picture. With this, you can directly store the binary data of the picture in a column of your DB (see how to store / how to display).
So, what the good solution ? I'll say both :
Upvotes: 3