Answer the question
In order to leave comments, you need to log in
What are the rules for uploading photos to the site?
Good evening
, Please advise.
I will soon launch my marketplace, where people will be able to upload both a profile photo to the site and product photos to the site.
Now I'm talking with my developers and I can't find answers to the following questions:
Tell me, how best to set limits for the amount of photos uploaded by users? What is the optimal photo size for uploading (both profile photos and product photos)
How to implement the function of automatic reduction / optimization of a photo if a user uploads a photo larger than the size set on the site? Is it possible to do this at all?
Thanks in advance :)
Answer the question
In order to leave comments, you need to log in
Well, it all depends on the capabilities of the server and so on. Well, in general, now they usually use 2 mb.
There are many libraries and examples for image compression. Suppose a user sends an image weighing 4 mb, it is necessary to determine the compression ratio 4mb / 2mb = 2, which means the coefficient will be equal to two and we compress the image by 2 times. Better yet, make one even smaller thumbnail to offload the server.
Let's say a 2mb image and a 400kb thumbnail.
You did not specify which technologies you use, so the examples will be in php.
Image compression in php
<Image library
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question