Skip to content

Commit

Permalink
Merge pull request #7431 from fjordllc/feature/resize-avatar-to-squar…
Browse files Browse the repository at this point in the history
…e-120-120

正方形に切り抜くように修正する
  • Loading branch information
komagata authored Mar 29, 2024
2 parents 24b90d7 + 2f350dd commit fd19b2a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class User < ApplicationRecord

authenticates_with_sorcery!
VALID_SORT_COLUMNS = %w[id login_name company_id last_activity_at created_at report comment asc desc].freeze
AVATAR_SIZE = [88, 88].freeze
AVATAR_SIZE = [120, 120].freeze
RESERVED_LOGIN_NAMES = %w[adviser all graduate inactive job_seeking mentor retired student student_and_trainee trainee year_end_party].freeze
MAX_PERCENTAGE = 100
DEPRESSED_SIZE = 2
Expand Down Expand Up @@ -593,11 +593,11 @@ def avatar_url
default_image_path = '/images/users/avatars/default.png'

if avatar.attached?
avatar.variant(resize_to_limit: AVATAR_SIZE, autorot: true, saver: { strip: true, quality: 60 }).processed.url
avatar.variant(resize_to_fill: AVATAR_SIZE, autorot: true, saver: { strip: true, quality: 60 }).processed.url
else
image_url default_image_path
end
rescue ActiveStorage::FileNotFoundError, ActiveStorage::InvariableError
rescue ActiveStorage::FileNotFoundError, ActiveStorage::InvariableError, Vips::Error
image_url default_image_path
end

Expand Down

0 comments on commit fd19b2a

Please sign in to comment.