AlmogBaku / imageMask

jQuery imageMask
http://almogbaku.github.com/imageMask/
46 stars 7 forks source link

CORS issues with canvas and cross origin images #4

Closed jwarchol closed 9 years ago

jwarchol commented 11 years ago

I had to modify the library as follows to get it working with cross origin (different domain) images.

@@ -30,6 +30,7 @@
                        maskObj = _mask;
                } else {
                        maskObj = new Image();
+                       maskObj.crossOrigin = "Anonymous";
                        maskObj.src = _mask;
                }

@@ -52,6 +53,7 @@

                                //reRender image
                                var img = new Image();
+                               img.crossOrigin = "Anonymous";
                                img.src = $( this ).attr( 'src' );
                                $( img ).load( function() {
                                        drawImg( $canvasObj, ctx, img );

What about making this configurable when calling the plugin?

AlmogBaku commented 9 years ago

Hey @jwarchol, sorry for the late(late? its freakin' 2 years) response.

If still relevant- you are welcome to send a PR.

jwarchol commented 9 years ago

Thank you for the reply. I'm no longer working on that project so I'll close this issue.

Cheers!

AlmogBaku commented 9 years ago

lol :) makes sense haha (I forgot about this project actually.. and about jQuery too.. praise the Angular! haha)

Have a great new year pal!, ~ Almog