Skip to content

Instantly share code, notes, and snippets.

@matthewblack
Created January 26, 2016 19:20
Show Gist options
  • Select an option

  • Save matthewblack/3dc931f7a2089693ab96 to your computer and use it in GitHub Desktop.

Select an option

Save matthewblack/3dc931f7a2089693ab96 to your computer and use it in GitHub Desktop.
FilePicker Crop UI Bug?
(function() {
var ready;
ready = function() {
return $('.upload-picture').click(function(e) {
return filepicker.pick({
cropRatio: 3 / 2,
mimetype: 'image/*',
conversions: ['crop', 'rotate', 'filter'],
imageDim: [600, 400],
cropDim: [600, 400],
webcamDim: [600, 400],
services: ['COMPUTER', 'FACEBOOK', 'INSTAGRAM', 'WEBCAM']
}, function(blob) {
return $.ajax({
url: 'users/update_avatar',
type: 'POST',
data: {
user: {
avatar: blob.url
}
},
success: function(data) {
return $('.user-avatar-image').fadeOut(300, function() {
$(this).attr('src', blob.url).bind('onreadystatechange load', function() {
if (this.complete) {
$(this).fadeIn(300);
}
});
});
}
});
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment