diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index b638159c9..22f0ad84d 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -31,6 +31,7 @@ class AvatarController < ApplicationController end end + size = @temp_file.size if @temp_file && (@temp_file.size > 0) if @temp_file.size > Setting.upload_avatar_max_size.to_i @status = 1 @@ -81,7 +82,7 @@ class AvatarController < ApplicationController sleep(3) - unless File.size(diskfile) > 0 + unless File.size(diskfile) < size logger.info("###############################################################sleep") sleep(0.5) end diff --git a/lib/trustie/utils/image.rb b/lib/trustie/utils/image.rb index 7e23e7b66..c9bde109d 100644 --- a/lib/trustie/utils/image.rb +++ b/lib/trustie/utils/image.rb @@ -35,20 +35,20 @@ module Trustie def compress(size=300) backup if @bak - begin - f = Magick::ImageList.new(@file) - if f.format != 'GIF' - width = size - if f[0].columns > width - proportion = (width/f[0].columns.to_f) - height = (f[0].rows*proportion) - f.resize_to_fill!(width,height.to_i) - f.write(@file) - end - end - rescue Exception => e - Rails.logger.error "[Error] compress : ===> #{e}" - end + # begin + # f = Magick::ImageList.new(@file) + # if f.format != 'GIF' + # width = size + # if f[0].columns > width + # proportion = (width/f[0].columns.to_f) + # height = (f[0].rows*proportion) + # f.resize_to_fill!(width,height.to_i) + # f.write(@file) + # end + # end + # rescue Exception => e + # Rails.logger.error "[Error] compress : ===> #{e}" + # end end def backup