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

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.

Topic cropping functions images customization Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.