Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can you modify the function of the download button? #876

Open
afroCoderHanane opened this issue Jul 8, 2023 · 2 comments
Open

How can you modify the function of the download button? #876

afroCoderHanane opened this issue Jul 8, 2023 · 2 comments
Labels

Comments

@afroCoderHanane
Copy link

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.

@b-yp
Copy link

b-yp commented Aug 2, 2023

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

@faizux
Copy link

faizux commented Sep 6, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants