1.修正RImagic保存gif格式图片问题

2.修正课程动态显示问题
This commit is contained in:
nwb 2014-08-28 11:52:02 +08:00
parent c7caa08c70
commit 19be668221
2 changed files with 19 additions and 7 deletions

View File

@ -55,17 +55,20 @@ class AvatarController < ApplicationController
# saved = @avatar.save
begin
f = Magick::ImageList.new(diskfile)
width = 300.0
proportion = (width/f[0].columns)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height)
# f.scale!(width,height)
f.write(diskfile)
# gif格式不再做大小处理
if f.format != 'GIF'
width = 300.0
proportion = (width/f[0].columns)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height)
f.write(diskfile)
end
rescue Exception => e
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
end
respond_to do |format|
format.js
format.api {

View File

@ -605,6 +605,15 @@ class CoursesController < ApplicationController
events = @activity.events(@date_from, @date_to, :is_public => 1)
end
# 无新动态时,显示老动态
if events.count == 0
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events
else
events = @activity.events(:is_public => 1)
end
end
@offset, @limit = api_offset_and_limit({:limit => 10})
@events_count = events.count
@events_pages = Paginator.new @events_count, @limit, params['page']