F
F
FlooDwm2018-07-18 10:34:14
PHP
FlooDwm, 2018-07-18 10:34:14

How to find out the weight (in kilobytes) of an image after processing, but before saving it on the server?

There is a picture on which actions are performed, after which it is saved on the server. How to find out how much the image will weigh BEFORE saving it on the server, for example, to reduce its quality, or if this is not possible, then what is the best way to set limits on the weight of the image in bytes?
Save -> imagejpeg($source, $path, $imageQuality);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2018-07-18
@Arik

Usually they just optimize images for the web, and do not go to specific numbers. Today, if you do not need the original image dimensions, then we set the ceiling to 2048x2048 and the quality is 75-85, it’s good for the retina and it will be possible to cut the rest of the sizes. Those. we store the original only if necessary and there are no problems with the place, otherwise we consider the original 2048x2048

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question