I've been trying to create simple avatar change/crop/upload functionality with jCrop and PHP. Everything is working perfectly on Chrome and Opera, but it fails on Safari, Firefox and Internet Explorer (all are last versions). So here is the problem - when I try to change my avatar and cropping is initialised on Chrome and Opera it looks like this:
And when I try to do the same on Firefox, Safari or Internet Explorer this is happening:
So my implementation is quite simple i just make ajax call with chosen image with HTML5 FormData API then PHP is handling the request make a temporary file and return Base64 encoded image which i show and trying to crop. When my ajax call have success response i simply do:
initializeCropping: function() {
var _this = this;
this.image.Jcrop({
onSelect: function(coords) {
_this.trackCoordinates(coords);
},
bgColor: 'black',
bgOpacity: .4,
minSize: [300, 300],
setSelect: [ 0, 0, 300, 300 ],
aspectRatio: 1,
boxWidth: 310,
boxHeight: 310
}, function() { _this.jCropApi = this; });
}
("this.image" is reference to jQuery selector to already created image object) I also tried to set some timeout with javascript before initialising jCrop regarding this question, but the result is the same.. Any ideas? Thank you in advance! :)
Edit: It works only when select the same image second time...