Get resource type in js
Hi I am using the Upload Wiget, to upload assets (images, videos and PDF), in the moment I'm only saving the Public ID. The problem I did not found a method to receive the resource type from a Public ID, in order to know which function to use to display the Asset.
$.cloudinary.imageTag
or
$.cloudinary.video
-
Hi,
We highly recommend to save the public id, resource type and type, and original format that is returned back from the upload widget. Those three values should be enough to generate the Cloudinary URL. I would highly recommend adding those to your database and you would need to use the Admin API to query all your assets (https://cloudinary.com/documentation/admin_api#get_resources) and save the additional fields.
If nothing special was done to those files when you uploaded them, then most likely they will be:
- Images - by default are resource type image, type upload
- Videos - by default, are resource type video, type upload
- PDF - by default, are resource type image, type uploadHope this helps.
0
Post is closed for comments.
Comments
1 comment