ailon / markerjs2

Add image annotation to your web apps.
https://markerjs.com
Other
142 stars 39 forks source link

Help with render addEventListener #186

Closed waruhachi closed 9 months ago

waruhachi commented 9 months ago

Hello,

I'm trying to use the library but the code inside the render event never runs. My end goal is to do some processing on the edited image. I have to do this to bypass the Tainted canvases issue because the anonymous cross-origin solution cannot be used in my situation.

Please guide me in the correct direction.

function showMarkerArea(target) {
    var markerArea = new markerjs2.MarkerArea(target);

    markerArea.settings.displayMode = 'popup';

    markerArea.addEventListener("render", (event) => {
      console.log(event);
      target.src = event.dataUrl;
    });

    markerArea.show();
  }
ailon commented 9 months ago

Hi. Based on the intro paragraph, I assume that the code in the render event handler doesn't run simply because you get a CORS/tainted canvas error before it could run, correct?

If the CORS issue cannot be resolved in an orderly fashion, then I think the only option is to look for some tricks to work around it. I think quite a while ago I saw some libraries that would somehow download and regenerate the images, or something like that. Unfortunately, I don't have any links or specific details handy. But hopefully this gives you some hints on what to look for.

waruhachi commented 9 months ago

Hey,

Thanks for the response! I was able to solve the tainted canvas issue.