头像上传

This commit is contained in:
cxt 2017-03-14 16:30:04 +08:00
parent 931022c7b1
commit 9468257c0c
2 changed files with 13 additions and 4 deletions

View File

@ -75,10 +75,12 @@ class AvatarController < ApplicationController
end
@temp_file = nil
while !File.exists?(diskfile)
logger.info("###############################################################sleep")
sleep(0.5)
end
# while !File.readable?(diskfile)
# logger.info("###############################################################sleep")
# sleep(0.5)
# end
@src_file = diskfile
respond_to do |format|
format.json{

View File

@ -1,5 +1,12 @@
<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization'|| @source_type == 'Contest') %>
var imgSpan = $("img[nhname='avatar_image']");
<% if @urlfile && @src_file
while !File.readable?(@src_file)
logger.info("###############################################################1__________sleep")
sleep(0.5)
end
end
%>
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% else %>
var imgSpan = jQuery('#avatar_image');