M
M
Michael2019-04-14 00:23:43
Yii
Michael, 2019-04-14 00:23:43

How to compress images when uploading to a website?

Hello everybody! Can you please tell me how you can compress images when uploading to the site? The CostaRico/yii2-images widget is used to upload an image . The problem is that the user uploads very voluminous images to the site, from 3 to 5 MB in size and with a resolution of 4000 or 5000 pixels. Maybe somehow you can determine the resolution of the uploaded photo in the controller, and if it exceeds, for example, 1000 pixels in width, then reduce the uploaded photo to the maximum allowable for uploading?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-04-14
@inoise

We did this at one time and are happy. Well, of course, you need to cache the result. Keeping resizes is usually painful and I do not advise you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question