Git Product home page Git Product logo

Comments (7)

 avatar commented on August 14, 2024 3

I'm still having issues in firefox 50.1.0. The image doesn't get loaded the first time I select an image but every subsequent time it works fine. I tried both noFileInput false and true.
Works in Chrome.

ng2-img-cropper 0.7.6
angular 2.2.3

from angular2-img-cropper.

reactionic127 avatar reactionic127 commented on August 14, 2024 1

@CamusAran
How can I detect image load is success on frontend side?

from angular2-img-cropper.

frankfarzan avatar frankfarzan commented on August 14, 2024

You can easily repro this in Safari where out of band parameters are passed to ctx.getImageData()

from angular2-img-cropper.

joerex avatar joerex commented on August 14, 2024

Works for me @frankfarzan!

from angular2-img-cropper.

cstefanache avatar cstefanache commented on August 14, 2024

I can reproduce it only on Firefox ... Investigating now

from angular2-img-cropper.

cstefanache avatar cstefanache commented on August 14, 2024

The issue was fixed - I was able to reproduce it rarely on my computer but I noticed that the loadend event was fired before image was loaded. Fixed it using a setInterval and checked if nativeHeight > 0. Will be released on 0.6

from angular2-img-cropper.

mihaicrisan avatar mihaicrisan commented on August 14, 2024

@CamusAran Had the same problem solved , in imageCropperComponent.ts
`

  public setImage(image: HTMLImageElement) {
     let self = this;
        this.intervalRef = window.setInterval(function() {
         //if (self.intervalRef) {clearInterval(self.intervalRef);}   <- REMOVE/COMMENT THIS
           if (image.naturalHeight > 0) {

            image.height = image.naturalHeight;
            image.width = image.naturalWidth;

            clearInterval(self.intervalRef);
            self.getOrientedImage(image, (img: HTMLImageElement) => {
                self.cropper.setImage(img);
                self.image.original = img;
                let bounds = self.cropper.getCropBounds();
                self.image.image = self.cropper.getCroppedImage().src;
                self.onCrop.emit(bounds);
            });
        }
    }, 100);

}`

from angular2-img-cropper.

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.