How to fetch hundreds of images from Cloudinary?
Hello. I'm new to Cloudinary and would like to see if I'm on right track.
I have hundreds of small images that I will upload to Cloudinary to then fetch them and take advantage of CDN. Is this "right thing" to do? (basically using Cloudinary as an image hosting platform + CDN)
Images have different names, with Cloudinary appending extra random characters at the end. How can I fetch all the images from React app when I don't know their names exactly? Is there some kind of API endpoint that lists those? Is this the right approach?
I'll appreciate any directions, thanks for your attention.
-
Hi Toma,
You can use the original filename of the asset without appending any random characters by using the upload method parameters:
use_filename:true
&unique_filename:false
(see more information here).In the case that you want random public_id together with appending random characters, you can retrieve all your assets by using the resource list, as described in this link. And using the JSON data, you can parse and get the delivery URL of the different images that you want to display. Alternatively, you can also manage your assets using tags or by folder, and then use the Search API based on certain categories needed for your use case implementations (see sample in this link).
Hope this helps.
-
Thanks Eric, this helps!
I was wondering if there was an option to remove random characters at the end when manually uploading images in the media library (from the website). What is the reason Cloudinary appends random characters? Does it have something to do with caching assets? I'd rather keep them if it's important.
-
Hi Toma,
Thanks for getting back.
The random characters are appended so if you accidentally upload an asset with the same name, it doesn't get overwritten.
You can remove random characters whilst uploading from the DAM UI. So first create a singed upload preset per this link and then per Eric's update make sure that `use_filename:true` & `unique_filename:false` are set in the `Storage and access` tab.
Finally once the preset is created, set it as the default for the required asset types under `Media library's upload presets` so it will only get used via the DAM UI.
You can also specify what preset to use via the widget that appears when the upload button is clicked but we will need to enable this feature for you so let us if you'd like this by providing your cloud name via a direct ticket .
Kind Regards,
Thomas
Post is closed for comments.
Comments
4 comments