How to get the minimum image size with crop using PHP with aspect ratio?

I want to constrain the minimum width and height of the crop selection area in the format so that the user cannot grab a very small part of the image.

For example, a user uploaded image with width = 602px and height = 400px, in this case the minimum clipping selection area?

according to the minimum selectable subgrid area Google+ width = 574px and height = 323px the user cannot make it less than this size.

what is the logic?

FYI above logic I'm looking for cover photo like google plus

thank

+3


source to share


1 answer


After a long wait, I just applied logic and it works for me as an aspect.

var min_crop_width = (Original_Width / 100) * 83.5; // Minimum percentage
var min_crop_height = (min_crop_width / 5) * 1; // Your Standard Ratio...
min_crop_width = (min_crop_height * 5) / 1; // Your Standard Ratio...

      



Thank!

0


source







All Articles