Skip to content
Cloudinary upload addon for cockpit cms
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor
LICENSE
README.md
bootstrap.php
composer.json
composer.lock
config.php

README.md

cockpit-cloudinary

Cloudinary upload addon for cockpit cms

Note : This is not an official Cockpit addons, I just built this for my hobby project.

Installation

  • Add cockpit-cloudinary folder inside "addons" folder
  • Edit config.php and add cloudinary api keys.

Request

  • Route to request = "/cloudinary"

Upload example

var myInput = document.querySelector('input[type="file"]');

var data = new FormData();
data.append('file', myInput.files[0]) ; // File to upload goes here!!!

fetch('/api/cloudinary?token=cockpit-token-key', {
  method: 'POST',
  body: data
}).then(e=>e.json()).then(res=>{
        console.log(res)
    })
})

Delete example

var data = new FormData();
var public_id = ' '  // place the public_id you want to delete here!!!
data.append('imgId',public_id) 
fetch('/api/cloudinary?token=cockpit-token-key', {
  method: 'POST',
  body: data
}).then(e=>e.json()).then(res=>{
        console.log(res)
    })
})

Credit goes to

  • Cockpit CMS
  • Cloudinary

Author - Ronald Aug

You can’t perform that action at this time.