Get Image metadata with Javascript
Hi there,
I'm trying to get an image metadata using the its publicId, but I can't find a way to do so using the `cloudinary-core`. Seems to be able to do it in all languages but js.
Am I missing something?
Thanks
-
Hi Maxime,
Please try this code and let me know if it helps you (Node) :
cloudinary.uploader.explicit("{public_id}", {type:"upload",
image_metadata:"true"}, function(err,data){
if (err) {
console.log(err)
} else {
console.log(data)
}
});0 -
Hi Yakir, thanks for the answer.
I've tried that already but it's throwing me `cannot read property 'explicit' of undefined`.
Do I need to import something else than `cloudinary-core`?
0 -
Hi Maxime,
Could you please share with me the code you are using?
Thanks,
Yakir
0 -
Hey,
I'm using something like this:
componentDidMount() {
const cl = new cloudinary.Cloudinary({
cloud_name: cloudinaryCloudName,
});
const { name } = this.props;
cl.uploader.explicit(name, { type: 'upload', image_metadata: 'true' }, function(err, data){
console.log(err);
console.log(data);
});
}0 -
Hi Maxime,I'm very sorry for my late response.Please try to use this code:
var cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: '<cloud>'
,api_key: '<api_key>'
,api_secret: '<api_secret>
});
cloudinary.uploader.explicit(name,
{
type: 'upload',
image_metadata: 'true'
}, function(err, data) {
console.log(err);
console.log(data);
});
0 -
Hi
I am using this function on my node server.
async function retrieveImages(prefix) {
let results = await cloudinary.v2.api.resources({
type: "upload",
prefix: prefix,
tags: true,
max_results: 500,
context: true,
image_metadata: true,
imageMetadata: true});
return results.resources.map(processResource);
}
How can I tell it also retrieve meta day .
Daniel0 -
Hi Daniel,
`image_metadata` should return the metadata in the response. You don't need to pass both imageMetadata and image_metadata. What are you seeing in the response?
If you continue seeing the issue then can you please open a support ticket here: https://support.cloudinary.com/hc/en-us/requests/new and share the cloud name and value of the params you are passing and we will be able to debug better.
Thanks,
Aditi
0
Post is closed for comments.
Comments
7 comments