K
K
kedrovdanil2020-10-01 16:06:49
Image optimization
kedrovdanil, 2020-10-01 16:06:49

How to compress uploaded images on a website?

The bottom line is this: there is a website, the back works on Laravel (PHP), the front on React.js. Users on the site can upload photos. They must be a certain size after loading (290px by 175px). How can I optimize a photo on upload or after upload on the server side?

If a user uploads a 1920x800 photo, then it should be compressed to the required 290x175, taking into account the aspect ratio and a slight deterioration in quality, and given to the front in the future in such a compressed form. The most common formats are jpeg, png.

What can be done to implement this? As far as I know, JS is not capable of pinching on the front side. Or am I wrong?

PS If someone worked with the Intervention Image (Laravel) library, then write how it is? Does it work well?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question