10

I've using Croppie jQuery Library for crop a image but facing a problem when it will create multiple instances.

I've found no documentation about destroy instance.

function initCrop() {
    var $uploadCrop;
    $('#image_crop').destroy();
    $uploadCrop = $('#image_crop').croppie({
        viewport: {
            width: WIDTH,
            height: HEIGHT,
            type: 'square'
        },
        boundary: {
            width: 798,
            height: 480
        },
        exif: true
    });
}
Govind Samrow
  • 9,981
  • 13
  • 53
  • 90

1 Answers1

28

Found a solution:

$('#image_crop').croppie('destroy');

For more detail refer Croppie.

Govind Samrow
  • 9,981
  • 13
  • 53
  • 90
  • oh my days, where were you an hour ago, been trying to get this to work for what feels like an eternity!! – Phil Aug 27 '19 at 15:32