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 width and height of the image.
In this example, I have taken a square of dimension 500 with gravity auto so that it crops and focuses on the main part of the image. More information about gravity here.
3. Once saved, you can set this 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 now on will automatically be cropped square :)
Example:
Original Image: https://res.cloudinary.com/aditimadan/image/upload/v1553288210/baking-chocolate-close-up-2014693_wvayhk.jpg
Square cropped image: https://res.cloudinary.com/aditimadan/image/upload/v1553288031/baking-chocolate-close-up-2014693_rvb0ba.jpg
This can also be achieved using the API by specifying the incoming transformation on upload.
Comments
0 comments
Please sign in to leave a comment.