将上传的头像压缩至50x50大小。请确保运行环境RMagick可用。
This commit is contained in:
parent
9abdd44b63
commit
81eca9f238
|
@ -53,6 +53,13 @@ class AvatarController < ApplicationController
|
|||
# @avatar.source_id = User.current.id
|
||||
# @avatar.image_file = params[:filename].presence || Redmine::Utils.random_hex(16)
|
||||
# saved = @avatar.save
|
||||
begin
|
||||
f= Magick::ImageList.new(diskfile)
|
||||
f.scale!(50,50)
|
||||
f.write(diskfile)
|
||||
rescue
|
||||
end
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
Loading…
Reference in New Issue