diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 43d3451c..a3d3f416 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -25,7 +25,7 @@ class UserController < ApplicationController def update user_attributes = params.require(:user).permit(:display_name, :profile_picture, :profile_header, :motivation_header, :website, - :location, :bio, :crop_x, :crop_y, :crop_w, :crop_h) + :location, :bio, :crop_x, :crop_y, :crop_w, :crop_h, :crop_h_x, :crop_h_y, :crop_h_w, :crop_h_h) if current_user.update_attributes(user_attributes) text = 'Your profile has been updated!' text += ' It might take a few minutes until your new profile picture is shown everywhere.' if user_attributes[:profile_picture] diff --git a/lib/paperclip_processors/cropper.rb b/lib/paperclip_processors/cropper.rb index f2677029..74626004 100644 --- a/lib/paperclip_processors/cropper.rb +++ b/lib/paperclip_processors/cropper.rb @@ -14,7 +14,12 @@ module Paperclip def crop_command target = @attachment.instance if target.cropping? - ['-crop', "'#{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}'"] + case @attachment.name + when :profile_picture + ['-crop', "'#{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}'"] + when :profile_header + ['-crop', "'#{target.crop_h_w.to_i}x#{target.crop_h_h.to_i}+#{target.crop_h_x.to_i}+#{target.crop_h_y.to_i}'"] + end end end end