Browse Source

Little fixes in Crop Avatar action.

Ralfp 12 years ago
parent
commit
7b5f6adc8e
2 changed files with 2 additions and 12 deletions
  1. 1 2
      misago/usercp/avatar/views.py
  2. 1 10
      templates/sora/usercp/avatar_crop.html

+ 1 - 2
misago/usercp/avatar/views.py

@@ -178,8 +178,7 @@ def crop(request, upload=False):
                     request.user.avatar_type = 'upload'
                     request.user.avatar_type = 'upload'
                     request.user.avatar_original = '%s_org_%s%s' % (request.user.pk, get_random_string(8), image_extension)
                     request.user.avatar_original = '%s_org_%s%s' % (request.user.pk, get_random_string(8), image_extension)
                     source.save(image_path + request.user.avatar_original)
                     source.save(image_path + request.user.avatar_original)
-                else:
-                    request.user.delete_avatar_temp()
+                request.user.delete_avatar_temp()
                 request.user.avatar_image = image_name
                 request.user.avatar_image = image_name
                 request.user.save(force_update=True)
                 request.user.save(force_update=True)
                 
                 

+ 1 - 10
templates/sora/usercp/avatar_crop.html

@@ -43,22 +43,13 @@
         var crop_w = $('#crop-w');
         var crop_w = $('#crop-w');
         var crop_x = $('#crop-x');
         var crop_x = $('#crop-x');
         var crop_y = $('#crop-y');
         var crop_y = $('#crop-y');
-        
-        var target_w = $('#target').width();
-        var target_h = $('#target').height();
 
 
-        if (target_w > target_h) {
-        	start_select = [ 0, 0, target_h, target_h ];
-        } else {
-        	start_select = [ 0, 0, target_w, target_w ];
-        }
-        
         $('#target').Jcrop({
         $('#target').Jcrop({
           onChange: updatePreview,
           onChange: updatePreview,
           onSelect: updatePreview,
           onSelect: updatePreview,
           aspectRatio: 1,
           aspectRatio: 1,
           minSize: [50, 50],
           minSize: [50, 50],
-          setSelect: start_select,
+          setSelect: [ 0, 0, 5000, 5000 ],
         },function(){
         },function(){
           // Use the API to get the real image size
           // Use the API to get the real image size
           var bounds = this.getBounds();
           var bounds = this.getBounds();