When uploading images to Cloudinary you can specify the dimension and crop on upload.
Steps to follow when uploading from the UI or client-side:
1. Create an upload preset. Go to https://cloudinary.com/console/settings/upload and click on Add upload preset.
2. Navigate to Upload Manipulations and specify the dimensions in terms of the width and height of the image.
In this example, We've taken a square of dimension 500 with gravity auto so that it crops and focuses on the main part of the image. You can find more information about gravity here.
3. Once saved, you can set the new preset as your default Media Library preset through the upload settings page mentioned above (scroll down to the "Default upload presets" section), or in case you are uploading from the client side, use this preset as the unsigned upload preset.
Tadaa.. images uploaded will now automatically be cropped square :)
Square cropped image: https://res.cloudinary.com/demo/image/upload/v1678871120/docs/sneaker22.png
This can also be achieved using the API by specifying the incoming transformation on upload.