Deleting Original Assets
When deleting an original image, all of its derived images (transformed versions) are deleted as well. How to destroy the original image and all it's derived versions can be found here.
-
Via the Media Library (UI):
- Navigate to your Cloudinary Media Library.
- Select the specific asset you intend to delete.
- Click the "Delete" button.
- Confirm the deletion prompt.
-
Via the Admin API:
- Utilize the
delete_resources
method within the Admin API for programmatic deletion. - Node.js example:
const cloudinary = require('cloudinary').v2; cloudinary.v2.api.delete_resources(['public_id_of_asset'], function(error, result) { console.log(result, error); });
- Utilize the
-
Via the Cloudinary CLI:
- Use the Cloudinary CLI to delete assets from your command line.
- Example:
cld uploader destroy <public_id>
Replacing Original Assets with Transformations:
To modify the original image, Cloudinary supports incoming transformations, this will transform your image before storing it in your account.
-
Via the Media Library (UI):
- Select the existing asset you wish to replace.
- Click the "Replace" button within the asset's details.
- Upload the new version of the asset.
-
Via the Upload API with incoming transformations:
- Employ the Upload API's
upload
method, specifying the existingpublic_id
to overwrite the asset, and add transformations. - Node.js example:
cloudinary.v2.uploader.upload('https://res.cloudinary.com/<cloud_name>/image/upload/<public_id>', { public_id: '<public_id>', transformation: {width: 200, height: 200, crop: 'pad'} }, function(error, result) { console.log(result, error); });
- Employ the Upload API's
Comments
0 comments
Please sign in to leave a comment.