Howto delete image from Cloudinary? SOLVED


I use: With my Meteor/Vue/Vuetify project

The component only have:

deleteImage () {
      this.$emit('delete', this.imgPublicId)
      this.imgPublicId = null

It delete the image on the view but not on Cloudinary

But howto dele a image on Cloudinary when push the delete button?


No one have an example I can see?


Have you looked at the cloudinary api?

How to upload files and images on meteor server


It works with

But had problems with it so I used the code files without all the packets stuff and made a component folder called v-cloudinary-upload

In v-cloudinary-upload.vue

deleteImage : function(){'cloudinaryprofildestroy',this.imgPublicId, function(error, response) {});

server -> main.js

    cloudinaryprofildestroy: function(public_id)
      let meteorUser2 = Meteor.userId();
      const cloudinaryApp = require('cloudinary');
        {_id: meteorUser2},
        {$set: { profileimage: null } }
    cloudinaryApp.uploader.destroy(public_id, function(result) { console.log(result) });


Meteor.startup(() => {

const cloudinaryApp = require('cloudinary');
cloud_name: 'xx',
api_key: 'xx',
api_secret: 'xx'

Insert image name into mongodb DB:

In v-cloudinary-upload.vue

formdata = null
            if (response.status !== 200) { // failure
              console.log('Image upload error', response.responseText)
              this.$emit('error', response.responseText)

            } else { // success
              let uploaded = JSON.parse(response.responseText)
              this.imgPublicId = uploaded.public_id
              this.$emit('input', uploaded.public_id)

    'cloudinaryprofilupdate',uploaded.public_id, function(error, response) {});

in main.js server

    cloudinaryprofilupdate: function(public_id)
      let meteorUser2 = Meteor.userId();
        {_id: meteorUser2},
        {$set: { profileimage: public_id } }


The last thing is to make a if statement on the

      :src="imgSrc" />

that tjeck the DB and that also works on the delete button

If you se any bugs in my code please reply