D
D
Damir19882017-02-24 23:32:07
Image processing
Damir1988, 2017-02-24 23:32:07

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

1 answer(s)
N
Nikita Dergachov, 2017-02-24
@Damir1988

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 question

Ask a Question

731 491 924 answers to any question