Coder Social home page Coder Social logo

Comments (15)

Willdta avatar Willdta commented on May 18, 2024 1

Could you provide more code? What is this here? What's props do you send to cropper?

this is in reference to my local component data.

Cropper component:

<cropper
  :src="uploadedPhoto"
  class="cropper"
  @change="cropImage"
/>

cropImage method (using TypeScript):

cropImage({ coordinates, canvas }: {
    coordinates: { width: number, height: number, left: number, top: number },
    canvas: HTMLCanvasElement
  }) {
    this.coordinates = coordinates;
    canvas.toBlob(blobData => {
      this.croppedPhoto = blobData;
    })
  }

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

Hello!

I've just tested this scenario and it is processed correctly.

Could you test uploading images at this example? What's the uploading images? What's the version of Firefox do you use?

from vue-advanced-cropper.

Willdta avatar Willdta commented on May 18, 2024

The version of Firefox I'm using is 69.0.1. The images are just regular PNG's, JPG's, JPEG's. I used the exact method you linked in the first place.

After further investigation, it seems like it clears at first but once my image is actually saved to the db, the coordinates mess up.

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

Let's define. Does this problem occur in my examples or this problem is specific to your code only? In the second case me need additional details about your code or an example at the codesandbox.

from vue-advanced-cropper.

Willdta avatar Willdta commented on May 18, 2024

Let's define. Does this problem occur in my examples or this problem is specific to your code only? In the second case me need additional details about your code or an example at the codesandbox.

Do you want anything specific in terms of my code?

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

First of all, I want to know, could you reproduce this problem at the documentation examples.

Secondly, if it's not possible, me need details about your specific case. Maybe, code that uses this library or something else.

from vue-advanced-cropper.

Willdta avatar Willdta commented on May 18, 2024
  1. No, I could not.

  2. When uploading the image I'm using the code you listed in the documentation. When clearing the input, I'm setting my image to null and my coordinates back to 0. Maybe I'm not correctly resetting my state? Here's what I'm using to reset it:

this.coordinates = { left: 0, height: 0, top: 0, width: 0}
this.uploadedPhoto = ""
this.croppedPhoto = null

I have also noticed these errors but I don't know if it's of any help:

Screen Shot 2019-09-27 at 1 20 43 PM

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

Could you provide more code? What is this here? What's props do you send to cropper?

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

And what's happening with uploadedPhoto?

from vue-advanced-cropper.

Willdta avatar Willdta commented on May 18, 2024

And what's happening with uploadedPhoto?

Exactly what is in your docs when uploading a photo.

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

Try to update to 0.12.4. I suppose, that the cause of this issue is incorrect handling of setting empty src prop value, and I've fixed this bug in the new version.

from vue-advanced-cropper.

Willdta avatar Willdta commented on May 18, 2024

Try to update to 0.12.4. I suppose, that the cause of this issue is incorrect handling of setting empty src prop value, and I've fixed this bug in the new version.

This fixed it!

There are some type errors I thought you should know about though:

Screen Shot 2019-09-27 at 6 51 55 PM

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

Canvas is undefined if src prop is empty. Maybe it's not obviously, but sending an empty canvas value is not the best solution too.

There is temporary fix:

cropImage({ coordinates, canvas }: {
    coordinates: { width: number, height: number, left: number, top: number },
    canvas: HTMLCanvasElement
  }) {
    this.coordinates = coordinates;
    if (canvas) {
      canvas.toBlob(blobData => {
        this.croppedPhoto = blobData;
      })
   } else {
      this.croppedPhoto = null;
   }
}

from vue-advanced-cropper.

Willdta avatar Willdta commented on May 18, 2024

Canvas is undefined if src prop is empty. Maybe it's not obviously, but sending an empty canvas value is not the best solution too.

There is temporary fix:

cropImage({ coordinates, canvas }: {
    coordinates: { width: number, height: number, left: number, top: number },
    canvas: HTMLCanvasElement
  }) {
    this.coordinates = coordinates;
    if (canvas) {
      canvas.toBlob(blobData => {
        this.croppedPhoto = blobData;
      })
   } else {
      this.croppedPhoto = null;
   }
}

Awesome man. Thanks so much for helping me out. I really appreciate it!

from vue-advanced-cropper.

Norserium avatar Norserium commented on May 18, 2024

You are welcome!

from vue-advanced-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.