fix for upload

This commit is contained in:
albert
2013-01-06 16:39:23 -05:00
parent dab4f2f559
commit e18da81720

View File

@@ -50,7 +50,6 @@ class Upload < ActiveRecord::Base
module ConversionMethods
def process! force=false
return if !force && status =~ /processing|completed|error/
return if Socket.gethostname != server
CurrentUser.scoped(uploader, uploader_ip_addr) do
update_attribute(:status, "processing")
@@ -145,6 +144,9 @@ class Upload < ActiveRecord::Base
end
Danbooru.resize(source_path, resized_file_path_for(width), width, height, quality)
if width == Danbooru.config.small_image_width
Danbooru.resize(source_path, ssd_file_path, width, height, quality)
end
end
end
@@ -213,6 +215,11 @@ class Upload < ActiveRecord::Base
"#{Rails.root}/public/data/#{prefix}#{md5}.#{file_ext}"
end
def ssd_file_path
prefix = Rails.env == "test" ? "test." : ""
"#{Rails.root}/public/ssd/data/#{prefix}#{md5}.#{file_ext}"
end
def resized_file_path_for(width)
prefix = Rails.env == "test" ? "test." : ""