Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-05-25 11:05:43 +08:00
commit 122de16180
3 changed files with 33 additions and 39 deletions

View File

@ -29,10 +29,6 @@ class AvatarController < ApplicationController
end
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)
@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)
end
end
Trustie::Utils::Image.new(diskfile,true).compress(300)
@status = 0
@msg = ''
else
@status = 2
@msg = l(:not_valid_image_file)
end
# self.digest = md5.hexdigest
end
@temp_file = nil
image = Trustie::Utils::Image.new(diskfile,true)
image.compress(300)
respond_to do |format|
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
}
format.js

View File

@ -2,3 +2,4 @@
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
$('#quote').val("<%= raw escape_javascript(@content) %>");
showAndScrollTo("new_memo", "cke_editor01");
$("img").removeAttr("align");

View File

@ -182,4 +182,5 @@
}
});
};
$("img").removeAttr("align");
</script>