viliusle / miniPaint

online image editor
http://viliusle.github.io/miniPaint/
Other
2.62k stars 610 forks source link

Unable to insert new layer in open_image function #236

Closed kumarSaurabh27 closed 3 years ago

kumarSaurabh27 commented 3 years ago

Getting abort error while inserting into Layer in open_image function, here is my code: function open_image(image) {

    if (typeof image == 'string') {
        image = document.getElementById(image);
    }
    var Layers = document.getElementById('myFrame').contentWindow.Layers;
    var name = image.src.replace(/^.*[\\\/]/, '');
    var new_layer = {
        name: name,
        type: 'image',
        data: image,
        width: image.naturalWidth || image.width,
        height: image.naturalHeight || image.height,
        width_original: image.naturalWidth || image.width,
        height_original: image.naturalHeight || image.height,
    };
    console.log(new_layer);
    Layers.insert(new_layer);
    console.log(Layers.insert(new_layer));

}

I am getting the 'need_autoresize is not defined' error. reason: ReferenceError: need_autoresize is not defined at t. status: "aborted"

Please check the same. I am not able to load the image on the editor.

viliusle commented 3 years ago

I pushed few fixes, try again with latest code from master branch.

viliusle commented 3 years ago

If you still have problems - let me know.