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

loadImageFromURL doesn't work including UI #103

Closed
joecodino opened this issue Dec 8, 2018 · 8 comments
Closed

loadImageFromURL doesn't work including UI #103

joecodino opened this issue Dec 8, 2018 · 8 comments
Labels

Comments

@joecodino
Copy link

Version

tui.image-editor-3.3.0

Development Environment

Windows 10 Pro (Chrome, Firefox, Edge - all up-to-date)

Current Behavior

Unable to load image from URL using the UI:

var imageEditor = new tui.ImageEditor('.tui-image-editor', {
    cssMaxWidth: 700,
    cssMaxHeight: 500,
	includeUI: {
	 theme: blackTheme, // or whiteTheme
	 menuBarPosition: 'bottom'
	}
});
imageEditor.loadImageFromURL('https://vignette.wikia.nocookie.net/googology/images/b/bd/Test.jpg', 'SampleImage');

Expected Behavior

Same as using the Load (from file) button: place the image on the canvas. Basicaly, using loadImageFromURL in examples\example01-includeUi.html doesn't work.

@lamkn
Copy link

lamkn commented Dec 19, 2018

the same issues, when I loaded url form S3

@T-vK
Copy link

T-vK commented Jan 4, 2019

loadImageFromURL is indeed not working. The issue can easily be reproduced: https://fiddle.sencha.com/#view/editor&fiddle/2org

@chadkouse
Copy link

chadkouse commented Jan 15, 2019

Here's a trick that seems to workaround the issue. You need to call imageEditor.ui.activeMenuEvent(); and imageEditor.ui.resizeEditor and give it the new image size

imageEditor.loadImageFromURL("https://fiddle.sencha.com/classic/resources/images/sencha-logo.png", "SampleImage2").then((sizeValue)=>{
              imageEditor.ui.activeMenuEvent();
              imageEditor.ui.resizeEditor({imageSize: sizeValue});
              console.log("Image allegedly loaded.")
          }).catch(e=>{
              console.error("Something went wrong:")
              console.error(e)
          })

Maybe some event handler isn't getting called internally?

@T-vK
Copy link

T-vK commented Jan 15, 2019

Another workaround can be found here: https://stackoverflow.com/questions/54155431/toastui-image-editor-loadimagefromurl-doesnt-work

It also explains the S3 issue @lamkn btw.

@gamcoh
Copy link

gamcoh commented Jun 11, 2019

@chadkouse the workaround for the Vue wrapper must be used like this:

imageEditor.editorInstance.ui.activeMenuEvent()
imageEditor.editorInstance.ui.resizeEditor({imageSize: sizeValue})

Hope that helps

@slightlynerd
Copy link

@gamcoh thanks, I've spent the last hour reading through both open and closed issues here. Your solution does was the only one that worked in the Vue app I'm working on.

@dubi92
Copy link

dubi92 commented Dec 31, 2019

I have the same issue with it on React, I implement a mobile version of it, which mean that I didn't includeUI, how can I solve this problem by calling resizeEditor when the UI doesn't initialize. Because currently the image is hidden somehow.

@T-vK
Copy link

T-vK commented Nov 13, 2020

@lja1018 Has this issue been fixed?

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

9 participants