Is it possible to batch process images after they have been uploaded, on per album instance?
I saw this answer here: related answer
I'm new here and wondering basically the same thing; but can you point me in the right direction for learning how to do this so images that are already uploaded? Like if there were a few transformations and resizing, how do this to all photos in a folder? Or where can I learn it or a video or tutorial? I've spent a lot of time reading all over this site and it seems a little overwhelming; need to cut to the chase and learn a solution :)
Thank you! Amy
-
Hi Amy,
The explicit method of the Upload API is mainly used to perform transformations on an already-existing resource in your Media Library account. And applying any image transformation can be done on each asset (i.e., one public_id at a time, using one of our client SDKs).
For example:
cloudinary.v2.uploader
.explicit("sample",
{ type: "upload",
eager: [
{ width: 400, height: 400,
crop: "crop", gravity: "face"},
{ width: 660, height: 400,
crop: "pad", background: "blue"} ]})
.then(result=>console.log(result));0 -
Thank you; but so your code block above looks like something that would be one on the website end and not inside of the Cloudinary Media Library or am I confused?
I'm looking for something where my customer can upload albums and not worry about any of the sizing or optimizing and then I can go into the dashboard and apply transformations and optimizations all in one batch and then call them back down to his site... is this possible? Sorry, I'm new with using Cloudinary and there seems like a lot to know about! And as I asked before I'm not sure 'where on your site' I can look to figure all of this out as far as what I'm trying to do. To be able to accomplish what I'm after where do I look and begin on the Cloudinary website?
Thanks again! Amy
0 -
Hi Amy,
The code that Eric shared is written in Node.js You would run this code on your computer using, for example, VS Code or something similar. The explicit method is how you can programmatically apply actions to assets that were already uploaded to your account.
If you want to do this through the UI, you could create a named transformation. The syntax for including a named transformation in the URL is `t_<name of transformation>'. For example, if you create a named transformation with the name of 'abc', you could apply the named transformation to the asset with the public id of 'sample' as follows: https://res.cloudinary.com/demo/image/upload/t_abc/cld-sample.jpg
You can reference the documentation on named transformations here:
https://cloudinary.com/documentation/image_transformations#named_transformationsIf your customer knows ahead of time what actions they would like to apply to their assets, you can create an upload preset for them to use as they are uploading their assets. You can read about upload presets here: https://cloudinary.com/documentation/dam_admin_upload_presets
I hope this helps. Let me know if you have any questions.
Kind Regards,
Tia
0
Post is closed for comments.
Comments
3 comments