summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-10-21 15:08:36 +0200
committerRobin Appelman <robin@icewind.nl>2016-10-21 15:08:36 +0200
commit55c445ff3917c6caf9baad2fe4db0c56b51c72bb (patch)
treee6eff277e7c62af2e14716bcb4532cce9cd66265 /settings
parentac167d4dc633f2087326dac7a28281f429d61af8 (diff)
downloadnextcloud-server-55c445ff3917c6caf9baad2fe4db0c56b51c72bb.tar.gz
nextcloud-server-55c445ff3917c6caf9baad2fe4db0c56b51c72bb.zip
set initial cropper to max size
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'settings')
-rw-r--r--settings/js/personal.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js
index c5d659e5c8c..34fffe7ddde 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -139,16 +139,18 @@ function showAvatarCropper () {
$cropperImage.attr('src',
OC.generateUrl('/avatar/tmp') + '?requesttoken=' + encodeURIComponent(oc_requesttoken) + '#' + Math.floor(Math.random() * 1000));
- // Looks weird, but on('load', ...) doesn't work in IE8
- $cropperImage.ready(function () {
-
+ $cropperImage.load(function () {
+ var img = $cropperImage.get()[0];
+ var selectSize = Math.min(img.width, img.height);
+ var offsetX = (img.width - selectSize) / 2;
+ var offsetY = (img.height - selectSize) / 2;
$cropperImage.Jcrop({
onChange: saveCoords,
onSelect: saveCoords,
aspectRatio: 1,
boxHeight: 500,
boxWidth: 500,
- setSelect: [0, 0, 300, 300]
+ setSelect: [offsetX, offsetY, selectSize, selectSize]
}, function() {
$cropper.show();
});