FIX: proper support for pixel ratios up to 3
This commit is contained in:
parent
4215690f40
commit
c3227b69fa
|
@ -17,14 +17,9 @@ module Jobs
|
||||||
self.send("create_thumbnails_for_#{type}", upload)
|
self.send("create_thumbnails_for_#{type}", upload)
|
||||||
end
|
end
|
||||||
|
|
||||||
PIXEL_RATIOS ||= [1, 2, 3]
|
|
||||||
|
|
||||||
def create_thumbnails_for_avatar(upload)
|
def create_thumbnails_for_avatar(upload)
|
||||||
PIXEL_RATIOS.each do |pixel_ratio|
|
|
||||||
Discourse.avatar_sizes.each do |size|
|
Discourse.avatar_sizes.each do |size|
|
||||||
size *= pixel_ratio
|
OptimizedImage.create_for(upload, size, size, allow_animation: SiteSetting.allow_animated_avatars)
|
||||||
OptimizedImage.create_for(upload, max, max, allow_animation: SiteSetting.allow_animated_avatars)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,18 @@ module Discourse
|
||||||
@anonymous_top_menu_items ||= Discourse.anonymous_filters + [:category, :categories, :top]
|
@anonymous_top_menu_items ||= Discourse.anonymous_filters + [:category, :categories, :top]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
PIXEL_RATIOS ||= [1, 2, 3]
|
||||||
|
|
||||||
def self.avatar_sizes
|
def self.avatar_sizes
|
||||||
# Don't cache until we can get a notification from site settings to expire cache
|
# TODO: should cache these when we get a notification system for site settings
|
||||||
set = Set.new(SiteSetting.avatar_sizes.split("|").map(&:to_i))
|
set = Set.new
|
||||||
# add retinas which are 2x dpi
|
|
||||||
set.to_a.each { |size| set << size * 2 }
|
SiteSetting.avatar_sizes.split("|").map(&:to_i).each do |size|
|
||||||
|
PIXEL_RATIOS.each do |pixel_ratio|
|
||||||
|
set << size * pixel_ratio
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
set
|
set
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue