Answer the question
In order to leave comments, you need to log in
How to compress images directly when uploading to the server?
I have always been interested in this question, there is little that is sensible on the Internet, the basics are online.
Answer the question
In order to leave comments, you need to log in
In php by calling external utilities. If lossless, then the best
jpegtran
pngquant + PNGZopfli (first first, then second)
imagick, gd there are a lot of manuals. www.php.su/articles/?cat=graph&page=014 at random
Purely theoretically, this is possible, especially with the advent of web assembly and the ability to use ready-made libraries for graphics optimization. Now it is very difficult.
There is a very simple way - aws s3 + aws lambda to upload files and process them after uploading to the server.
In my opinion, it makes no sense to compress images, they compress very badly. It only makes sense to change the resolution.
In php, compression on the fly, without an intermediate file, is most likely not to be done, but in Java - easily.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question