Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'size' of undefined #43

Open
AmFearLiath opened this issue Nov 30, 2015 · 1 comment
Open

Uncaught TypeError: Cannot read property 'size' of undefined #43

AmFearLiath opened this issue Nov 30, 2015 · 1 comment

Comments

@AmFearLiath
Copy link

Hello and thank you for this wonderfull plugin.

When i set a defaultImage and change it to another pic, i became following error after submit:

Uncaught TypeError: Cannot read property 'size' of undefined
request.onprogress @ picedit.js:701

In picedit.js line ~701 is the following code:

var request = new XMLHttpRequest();
request.onprogress = function(e) {
    if(e.lengthComputable) var total = e.total;
    else var total = Math.ceil(inputblob.size * 1.3);       //affected line 701
    var progress = Math.ceil(((e.loaded)/total)*100);
    if (progress > 100) progress = 100;
    _this.set_messagebox("Please Wait... Uploading... " + progress + "% Uploaded.", false, false);
};

the variable inputblob is set some lines above this

var inputblob = _this._dataURItoBlob(_this._image.src);

here is my code to call picEdit()

$(function() {
    $('#InfoFoto').picEdit({
        defaultImage: "images/restaurant/1/info/slider_1_1448399597.jpeg",
        maxWidth: "600",
        formSubmitted: function(response){
            $.get('pages/contentSlider.php?type=restaurantSlider&store=1', function (response) {                        
                var source = $('<div>' + response + '</div>');                        
                table = source.find('#infoDataTable');
                $("#infoDataTable").html(table);
            });
        }
    });
});

i wonder why inputblob is not defined and hope someone has any idea or a solution to fix this?

P.S.
I have changed all toDataURL("image/png") to toDataURL("image/jpeg"). Is it possible, that this cause a problem with _this._image.src?

@andyvr
Copy link
Owner

andyvr commented Feb 18, 2016

Can you give details on your OS/Browser versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants