Skip to content
Snippets Groups Projects
Unverified Commit 78d772af authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix #3807: Increase avatars to 400x400 max (#6651)

But do not upscale when they are smaller
parent e9e475a2
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,8 @@ module AccountAvatar ...@@ -7,8 +7,8 @@ module AccountAvatar
class_methods do class_methods do
def avatar_styles(file) def avatar_styles(file)
styles = { original: { geometry: '120x120#', file_geometry_parser: FastGeometryParser } } styles = { original: { geometry: '400x400#', file_geometry_parser: FastGeometryParser } }
styles[:static] = { geometry: '120x120#', format: 'png', convert_options: '-coalesce', file_geometry_parser: FastGeometryParser } if file.content_type == 'image/gif' styles[:static] = { geometry: '400x400#', format: 'png', convert_options: '-coalesce', file_geometry_parser: FastGeometryParser } if file.content_type == 'image/gif'
styles styles
end end
......
...@@ -4,6 +4,10 @@ module Paperclip ...@@ -4,6 +4,10 @@ module Paperclip
class LazyThumbnail < Paperclip::Thumbnail class LazyThumbnail < Paperclip::Thumbnail
def make def make
return File.open(@file.path) unless needs_convert? return File.open(@file.path) unless needs_convert?
min_side = [@current_geometry.width, @current_geometry.height].min
options[:geometry] = "#{min_side.to_i}x#{min_side.to_i}#" if @target_geometry.square? && min_side < @target_geometry.width
Paperclip::Thumbnail.make(file, options, attachment) Paperclip::Thumbnail.make(file, options, attachment)
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment