Coder Social home page Coder Social logo

Comments (11)

matheusdavidson avatar matheusdavidson commented on May 24, 2024 1

Hi there, thank you for posting your question.

You need to follow the readme.md, there is a part showing how to use cropperjs methods:

Using CropperJS methods:

Use @ViewChild in your component to get the element:

In your app.component.html

<angular-cropper #angularCropper ..>

And in your app.component.ts

//
// Import AngularCropperjsComponent
import { AngularCropperjsComponent } from 'angular-cropperjs';

//
// Get with @ViewChild
@ViewChild('angularCropper') public angularCropper: AngularCropperjsComponent;

Then just call the CropperJS method you want:

anywhere in your app.component.ts

//
// Get base64
this.angularCropper.cropper.getCroppedCanvas().toBlob((blob) =>{
    // blob is your base64..
});

from angular-cropperjs.

matheusdavidson avatar matheusdavidson commented on May 24, 2024 1

Remove checkCrossOrigin(it default to true), leave the config empty {} for now and it will work

from angular-cropperjs.

Coolhat1177 avatar Coolhat1177 commented on May 24, 2024 1

node_modules/angular-cropperjs/angular-cropperjs"' has no exported member 'AngularCropperjsComponent'. why this error is coming

from angular-cropperjs.

ahsanaasim avatar ahsanaasim commented on May 24, 2024

Thanks for the reply.

I tried this code before but getting this error

Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.

screen shot 2017-09-28 at 1 57 34 pm

from angular-cropperjs.

matheusdavidson avatar matheusdavidson commented on May 24, 2024

Are you using checkCrossOrigin? you need to use it otherwise toBlob won't work.

from angular-cropperjs.

matheusdavidson avatar matheusdavidson commented on May 24, 2024

see this: fengyuanchen/cropper#119

from angular-cropperjs.

ahsanaasim avatar ahsanaasim commented on May 24, 2024

this is what i used for cropperOptions
this.angularCropper.cropperOptions = { checkCrossOrigin: false, };

from angular-cropperjs.

ahsanaasim avatar ahsanaasim commented on May 24, 2024

But problem is my image is coming from a separate domain that. So i needed to set checkCrossOrigin to false;

from angular-cropperjs.

ahsanaasim avatar ahsanaasim commented on May 24, 2024

I solved the problem by allowing cors from server end. Thanks

from angular-cropperjs.

matheusdavidson avatar matheusdavidson commented on May 24, 2024

Good to hear, unfortunately that is a security limilation of the browser, not the plugin.

from angular-cropperjs.

matheusdavidson avatar matheusdavidson commented on May 24, 2024

@Coolhat1177, please open a new issue with this bug

from angular-cropperjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.