v1.18.x
barisusakli 8 years ago
parent e85e35cf0c
commit 531df7bd09

@ -241,22 +241,29 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components'
uploadModal.find('.upload-btn').on('click', function () { uploadModal.find('.upload-btn').on('click', function () {
var url = uploadModal.find('#uploadFromUrl').val(); var url = uploadModal.find('#uploadFromUrl').val();
if (!url) { if (!url) {
return; return false;
} }
socket.emit('user.uploadProfileImageFromUrl', {
uploadModal.modal('hide'); uid: ajaxify.data.uid,
pictureCropper.handleImageCrop({
url: url, url: url,
socketMethod: 'user.uploadCroppedPicture', }, function (err, url) {
aspectRatio: '1 / 1', if (err) {
allowSkippingCrop: false, return app.alertError(err);
restrictImageDimension: true, }
imageDimension: ajaxify.data.profileImageDimension,
paramName: 'uid',
paramValue: ajaxify.data.theirid,
}, onUploadComplete);
uploadModal.modal('hide');
pictureCropper.handleImageCrop({
url: url,
socketMethod: 'user.uploadCroppedPicture',
aspectRatio: '1 / 1',
allowSkippingCrop: false,
restrictImageDimension: true,
imageDimension: ajaxify.data.profileImageDimension,
paramName: 'uid',
paramValue: ajaxify.data.theirid,
}, onUploadComplete);
});
return false; return false;
}); });
}); });

@ -50,12 +50,7 @@ module.exports = function (User) {
}, next); }, next);
}, },
function (image, next) { function (image, next) {
User.setUserFields(uid, { next(null, image);
uploadedpicture: image.url,
picture: image.url,
}, function (err) {
next(err, image);
});
}, },
], callback); ], callback);
}; };

Loading…
Cancel
Save