fix for upload
This commit is contained in:
@@ -50,7 +50,6 @@ class Upload < ActiveRecord::Base
|
|||||||
module ConversionMethods
|
module ConversionMethods
|
||||||
def process! force=false
|
def process! force=false
|
||||||
return if !force && status =~ /processing|completed|error/
|
return if !force && status =~ /processing|completed|error/
|
||||||
return if Socket.gethostname != server
|
|
||||||
|
|
||||||
CurrentUser.scoped(uploader, uploader_ip_addr) do
|
CurrentUser.scoped(uploader, uploader_ip_addr) do
|
||||||
update_attribute(:status, "processing")
|
update_attribute(:status, "processing")
|
||||||
@@ -145,6 +144,9 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
Danbooru.resize(source_path, resized_file_path_for(width), width, height, quality)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -213,6 +215,11 @@ class Upload < ActiveRecord::Base
|
|||||||
"#{Rails.root}/public/data/#{prefix}#{md5}.#{file_ext}"
|
"#{Rails.root}/public/data/#{prefix}#{md5}.#{file_ext}"
|
||||||
end
|
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)
|
def resized_file_path_for(width)
|
||||||
prefix = Rails.env == "test" ? "test." : ""
|
prefix = Rails.env == "test" ? "test." : ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user