Get Image metadata with Javascript

Comments

7 comments

  • Avatar
    Yakir Perlin

    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
    Comment actions Permalink
  • Avatar
    Maxime Bonhomme

    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
    Comment actions Permalink
  • Avatar
    Yakir Perlin

    Hi Maxime,

    Could you please share with me the code you are using?

     

    Thanks,

    Yakir

    0
    Comment actions Permalink
  • Avatar
    Maxime Bonhomme

    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
    Comment actions Permalink
  • Avatar
    Yakir Perlin
    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
    Comment actions Permalink
  • Avatar
    Arbortree Creations

    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 .

    Daniel

    0
    Comment actions Permalink
  • Avatar
    Aditi Madan

    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
    Comment actions Permalink

Please sign in to leave a comment.