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

Is it possible to initialize cropper with external image url? #269

Open
IrynaBu opened this issue Nov 16, 2017 · 1 comment
Open

Is it possible to initialize cropper with external image url? #269

IrynaBu opened this issue Nov 16, 2017 · 1 comment

Comments

@IrynaBu
Copy link

IrynaBu commented Nov 16, 2017

The problem from #110 still exist.
client code

    const image: HTMLImageElement = new Image();
    image.addEventListener('load', (data) => {
      image.crossOrigin = "anonymous"; // or image.crossOrigin = "Anonymous";
      this.cropper.setImage(image);
    });
    image.src = this.config.image;

Also i try to add this.cropper.image.crossOrigin = "anonymous" still no lucky(

@mibzman
Copy link

mibzman commented Jan 3, 2018

I had the same issue today. Please note that this is not an issue with the image cropper itself, but a server-side CORS issue.

I was trying to load images from AWS s3 (which has awful CORS support), and I ended up building my own image proxy following the guidance here.

I then used this with:

    var image:any = new Image();
    image.crossOrigin = "Anonymous";
    image.onload = function(){
      that.cropper.setImage(image)
    }
    image.src = `${YOUR_PROXY}?url=${URL}`

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

No branches or pull requests

2 participants