picEdit
picEdit copied to clipboard
Uncaught TypeError: Cannot read property 'size' of undefined
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?
Can you give details on your OS/Browser versions?