fixed profile headers

This commit is contained in:
Georg G 2015-05-10 02:57:18 +02:00
parent 0145b36510
commit 91be970cb9
2 changed files with 7 additions and 2 deletions

View File

@ -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]

View File

@ -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