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);


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.

  • You can hook image_resize_dimensions to customise how crops and scaling are calculated. You probably just want to make the logic conditional on your 200x200 sizes, or pass a string as the crop parameter and detect that, so that the normal code is used for all other thumbnails.
    – Rup
    Oct 24, 2020 at 15:28
  • @rup This function works well. Thanks
    – Kalpesh
    Oct 26, 2020 at 5:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.