Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
122de16180
|
@ -29,10 +29,6 @@ class AvatarController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if @temp_file && (@temp_file.size > 0)
|
if @temp_file && (@temp_file.size > 0)
|
||||||
if @temp_file.size > Setting.upload_avatar_max_size.to_i
|
|
||||||
@status = 1
|
|
||||||
@msg = l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i))
|
|
||||||
elsif Trustie::Utils::Image.new(@temp_file.tempfile.path).image?
|
|
||||||
diskfile=disk_filename(@source_type,@source_id)
|
diskfile=disk_filename(@source_type,@source_id)
|
||||||
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
||||||
|
|
||||||
|
@ -60,20 +56,16 @@ class AvatarController < ApplicationController
|
||||||
md5.update(@temp_file)
|
md5.update(@temp_file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# self.digest = md5.hexdigest
|
||||||
Trustie::Utils::Image.new(diskfile,true).compress(300)
|
|
||||||
@status = 0
|
|
||||||
@msg = ''
|
|
||||||
else
|
|
||||||
@status = 2
|
|
||||||
@msg = l(:not_valid_image_file)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@temp_file = nil
|
@temp_file = nil
|
||||||
|
|
||||||
|
image = Trustie::Utils::Image.new(diskfile,true)
|
||||||
|
image.compress(300)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json{
|
format.json{
|
||||||
render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html'
|
render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||||
$('#quote').val("<%= raw escape_javascript(@content) %>");
|
$('#quote').val("<%= raw escape_javascript(@content) %>");
|
||||||
showAndScrollTo("new_memo", "cke_editor01");
|
showAndScrollTo("new_memo", "cke_editor01");
|
||||||
|
$("img").removeAttr("align");
|
|
@ -182,4 +182,5 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
$("img").removeAttr("align");
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue