Dom-to-image: Mobile [object Event] Error

Created on 3 Nov 2016  路  15Comments  路  Source: tsayen/dom-to-image

Use case: description, code

Im using the plugin on Ionic framework.
My app has a button to apply an image from the gallery into an

But the plugin doesn't render it. With alert() I got this error:

[object Event] Error

Any image included on the app www/img folder can be rendered.
I don't know how to workaround...

https://jsfiddle.net/ojb1b31r/3/

Expected behavior

Load the gallery image into tag

Actual behavior (stack traces, console logs etc)

Fire this error through alert()

[object Event] Error

Library version

/*! dom-to-image 02-03-2016 */

Browsers

  • [x ] Chrome 49+
  • [ ] Firefox 45+
cannot reproduce wontfix

All 15 comments

please use the issue template, it's there for a reason

I'm really, really sorry. I never posted an issue. I don't know what it is or how the issue template works.

When you create new issue, there is already some text in textarea, like this. That is a template. You 're supposed to fill it

I updated my answer :)

Good :) You're also supposed to put together a jsfiddle or something like that, to show me the actual code that doesn't work. The template contains a reference to an example jsfiddle.

I updated, but there's no way to put to work on the fiddle.
The plugin is amazing and with everything else do the job perfectly.
Just the gallery, or directly the web, or even when I download the file from web it doesn't :/

@rafaeldcastro If you are having issues with the fiddle you posted in the first post, here is an updated fiddle. https://jsfiddle.net/ojb1b31r/4/

@tsayen I've changed the resource feeder on the app.
Before it used a proper plugin of the Gallery ($cordovaImagePicker) to pick a photo and apply. This one, the dom-to-image didn't render it.
Now I use the $cordovaCamera plugin itself and worked!! It pick the photo I wanted, applied and render it.

For anyone who run into the same problem:

Just change the camera options to:

destinationType : Camera.DestinationType.DATA_URL, 
sourceType : Camera.PictureSourceType.SAVEDPHOTOALBUM,

I don't know why the cordovaImagePicker don't work, but I think it worth the study @tsayen.
Anyway I really appreciate your fast replies and teachings :D

o/

I posted the "same" doubt on satckoverflow and got a tip to use JSON.stringify on the error.

Got this: Error: {"isTrusted":true}

@rafaeldcastro have you come across anything like Dom exception 18 error? I posted an issue right before yours :)

@rafaeldcastro is there still a problem, or you've found a solution which works for you? (seems like you have)

@tsayen I've found a solution to my "situation", my need, yes!
The problem still exists!

Then what is the problem? The jsfiddle you've provided throws an error, but that's because you're trying to render a nonexistent node.

I'm using the cordova $ImagePicker plugin.
Its use is open the phone Image Gallery so the user can pick an image and then returns the image or an array of selected images for the app.

The dom-to-image throws an error for this imag/images. Like an image coming from a different domain (i think). Even downloaded images will be thrown an error.

So I change the aprouch. Instead of using the ImagePicker, I used the Camera plugin, to choose an image.
For this image, even the download ones, coming from the Camera plugin are ok! Dom-to-image rendered at 100%!!

So, my "problem" is solved. But the plugin still has an issue. Not impeditive, but still a problem :/

I'm not really familiar with Cordova. Your problem might be due to the CORS issue. That problem cannot be solved by this lib. I'm closing this issue for now, as it seems like nothing I can do here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

john-m-adams picture john-m-adams  路  9Comments

bernardoadc picture bernardoadc  路  4Comments

pete-hotchkiss picture pete-hotchkiss  路  6Comments

da1z picture da1z  路  6Comments

XiNiHa picture XiNiHa  路  4Comments