mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 12:11:16 -05:00
Merge pull request #1339 from ZogStriP/fix-custom-avatars-in-email
FIX: custom avatars in email
This commit is contained in:
commit
30caa0d0b0
2 changed files with 5 additions and 3 deletions
|
@ -308,7 +308,7 @@ class User < ActiveRecord::Base
|
|||
# - emails
|
||||
def small_avatar_url
|
||||
template = avatar_template
|
||||
template.gsub("{size}", "60")
|
||||
template.gsub("{size}", "45")
|
||||
end
|
||||
|
||||
def avatar_template
|
||||
|
|
|
@ -21,8 +21,10 @@ module Jobs
|
|||
# create a temp file with the same extension as the original
|
||||
temp_file = Tempfile.new(["discourse-avatar", File.extname(original_path)])
|
||||
temp_path = temp_file.path
|
||||
#
|
||||
Discourse.store.store_avatar(temp_file, upload, size) if ImageSorcery.new(original_path).convert(temp_path, gravity: "center", thumbnail: "#{size}x#{size}^", extent: "#{size}x#{size}", background: "transparent")
|
||||
# create a centered square thumbnail
|
||||
if ImageSorcery.new(original_path).convert(temp_path, gravity: "center", thumbnail: "#{size}x#{size}^", extent: "#{size}x#{size}", background: "transparent")
|
||||
Discourse.store.store_avatar(temp_file, upload, size)
|
||||
end
|
||||
# close && remove temp file
|
||||
temp_file.close!
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue