tui.image-editor icon indicating copy to clipboard operation
tui.image-editor copied to clipboard

How can you modify the function of the download button?

Open afroCoderHanane opened this issue 1 year ago • 2 comments

I am trying to send the image asset to an API when the download is triggered, does anyone have an idea on how to accomplish that.

afroCoderHanane avatar Jul 08 '23 00:07 afroCoderHanane

I am trying to send the image asset to an API when the download is triggered, does anyone have an idea on how to accomplish that.

+1

b-yp avatar Aug 02 '23 11:08 b-yp

I am trying to send the image asset to an API when the download is triggered, does anyone have an idea on how to accomplish that.

Give this a try: Use the toDataURL() method on the instance to retrieve the Base64 representation of the image/canvas. I experimented with something similar in a React component, and it was successful.

const instance = new ImageEditor(document.querySelector('#tui-image-editor'), { includeUI: { ..., theme: { 'menu.normalIcon.color': '#8a8a8a', 'menu.activeIcon.color': '#555555', 'menu.disabledIcon.color': '#434343', 'menu.hoverIcon.color': '#e9e9e9', 'submenu.normalIcon.color': '#8a8a8a', 'submenu.activeIcon.color': '#e9e9e9', }, ... } });

const dataURL = instance.toDataURL(); console.log(dataURL)

faizux avatar Sep 06 '23 22:09 faizux