mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-17 02:05:58 +08:00
add: update user image
This commit is contained in:
@@ -70,25 +70,6 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
def convert_image!
|
||||
return unless params[:image].present?
|
||||
max_size = EduSetting.get('upload_avatar_max_size') || 2 * 1024 * 1024 # 2M
|
||||
if params[:image].class == ActionDispatch::Http::UploadedFile
|
||||
@image = params[:image]
|
||||
render_error('请上传文件') if @image.size.zero?
|
||||
render_error('文件大小超过限制') if @image.size > max_size.to_i
|
||||
else
|
||||
image = params[:image].to_s.strip
|
||||
return render_error('请上传正确的图片') if image.blank?
|
||||
@image = Util.convert_base64_image(image, max_size: max_size.to_i)
|
||||
end
|
||||
rescue Base64ImageConverter::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def avatar_path(organization)
|
||||
ApplicationController.helpers.disk_filename(organization.class, organization.id)
|
||||
end
|
||||
|
||||
def organization_params
|
||||
params.permit(:name, :description, :website, :location,
|
||||
|
||||
Reference in New Issue
Block a user