How to crop image in WordPress with aspect ratio for any size of image

Question

I am using following function for cropping image in wordpress and I want to crop image in 1:1 aspect ratio. When I upload large image compared to specified size in function it works well but when I upload smaller image compare to specified in function size it does not produce 1:1 but it takes height or width that fits best and produce image in other aspect ratio.

add_image_size('member-photo', 200, 200, true);

https://developer.wordpress.org/reference/functions/add_image_size/

But I need 1:1 image in ratio so when ever user upload any size of image it cropped in that ratio.

Note: I don’t want to use different sizes of images.

0
Kalpesh 2 years 2020-10-24T09:10:20-05:00 0 Answers 10 views 0

Leave an answer

Browse
Browse