How to use provider-upload-cloudinary and automatic image tagging?

System Information
  • Strapi Version: 4.1.5
  • Database: PostgreSQL

I want to use Cloudinary’s automatic image tagging, but I have to store the tags in my local DB. So first I set up Cloudinary account, then I configured the provider-upload-cloudinary plugin:

upload: {
    enabled: true,
    config: {
      provider: 'cloudinary',
      providerOptions: {
        cloud_name: env('CLOUDINARY_NAME'),
        api_key: env('CLOUDINARY_KEY'),
        api_secret: env('CLOUDINARY_SECRET'),
      },
      actionOptions: {
        upload: {
          categorization: 'google_tagging',
          auto_tagging: 0.6
        },
        delete: {},
      },
    },
  }

I have an Image content type, which API I call when I want to upload an image:

this.$axios.$post('/images', data)

And here’s the Image controller:

module.exports = createCoreController('api::image.image', ({strapi}) => ({
  async create(ctx) {
    const data = JSON.parse(ctx.request.body.data)
    data.user = ctx.state.user.id
    ctx.request.body.data = JSON.stringify(data)
    let response
    response = await super.create(ctx)
    return response
  },
  //...
}

So far so good and after some additional configurations in the Cloudinary dashboard I can see the images uploaded and automatically tagged. But! they’re tagged only on Cloudinary, I’m not sure how to retrieve and save these automatically created tags. I guess (though I’m not sure) they’re returned in the response to the upload request to Cloudinary made by the plugin, but I don’t know how and where to retrieve them.

Any ideas, please?

1 Like

Im also having issues syncing cloudinary with strapi.

Would love to get some staff involved!

Ive contacted cloudinary support and they havent been able to fix the issue.