diff options
author | Johann Pardanaud <pardanaud.j@gmail.com> | 2016-02-17 18:35:16 +0100 |
---|---|---|
committer | Johann Pardanaud <pardanaud.j@gmail.com> | 2016-02-17 18:35:16 +0100 |
commit | bf6aa15512cc6d31be320204fbc3c115bfd11b1b (patch) | |
tree | caa9b9df87b31afc6ff144efac7045a6e4dd7386 /app/uploaders | |
parent | fb6d7df347016726d84155d18b6d6f406d0121e9 (diff) | |
download | gitlab-ce-bf6aa15512cc6d31be320204fbc3c115bfd11b1b.tar.gz |
Improve avatar cropping internals, based on suggestions made by @rspeicher on !2773
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/avatar_uploader.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index 60ee80cf002..c8d9ab072e8 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -10,15 +10,8 @@ class AvatarUploader < CarrierWave::Uploader::Base process :cropper - def is_integer? string - true if Integer(string) rescue false - end - def cropper - is_compliant = model.kind_of?(User) && is_integer?(model.avatar_crop_size) - is_compliant = is_compliant && is_integer?(model.avatar_crop_x) && is_integer?(model.avatar_crop_y) - - if is_compliant + if model.kind_of?(User) && model.valid? manipulate! do |img| img.crop "#{model.avatar_crop_size}x#{model.avatar_crop_size}+#{model.avatar_crop_x}+#{model.avatar_crop_y}" end |