]> source.dussan.org Git - nextcloud-server.git/commitdiff
Prevent flashing the full sized image when cropping an avatar
authorRobin Appelman <robin@icewind.nl>
Thu, 20 Oct 2016 13:57:34 +0000 (15:57 +0200)
committerRobin Appelman <robin@icewind.nl>
Thu, 20 Oct 2016 13:57:34 +0000 (15:57 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
settings/js/personal.js

index dbc82758fd138914af6816ca84142b123b77fee8..9f4a4f377b364f79a423f5e088925669bf96339f 100644 (file)
@@ -129,8 +129,9 @@ function updateAvatar (hidedefault) {
 
 function showAvatarCropper () {
        var $cropper = $('#cropper');
-       $cropper.prepend("<img>");
-       var $cropperImage = $('#cropper img');
+       var $cropperImage = $('<img/>');
+       $cropperImage.css('opacity', 0);
+       $cropper.prepend($cropperImage);
 
        $cropperImage.attr('src',
                OC.generateUrl('/avatar/tmp') + '?requesttoken=' + encodeURIComponent(oc_requesttoken) + '#' + Math.floor(Math.random() * 1000));
@@ -147,6 +148,8 @@ function showAvatarCropper () {
                        boxHeight: 500,
                        boxWidth: 500,
                        setSelect: [0, 0, 300, 300]
+               }, function() {
+                       $cropperImage.css('opacity', 1);
                });
        });
 }