editor-js / image

Image Block for Editor.js
MIT License
234 stars 282 forks source link

Cropping Feature #92

Open christoph-kluge opened 4 years ago

christoph-kluge commented 4 years ago

I have two questions in mind here:

a) Is it planned to support cropping in the future by this package? (internal own cropping module) b) Is there any plans to support some kind of pre-upload hooks where you can modify the image before it's uploaded (allows using custom cropping modules)

Duncank commented 4 years ago

You can do this with the custom uploader methods, that is how I do it. I take the file that has been selected and send it to my image cropper plugin (Doka). When cropping is done, I upload it to our servers with our own ajax-request plugin and return the necessary paths to this plugin.

uploader: {
    uploadByFile: (file) => this.processImageUpload(file),
    uploadByUrl: (url) => this.getFileFromURL(url)
        .then((file) => this.processImageUpload(file)).catch((err) => err),
},