smarter large file regen
This commit is contained in:
@@ -22,7 +22,7 @@ namespace :images do
|
||||
desc "Generate thumbnail-sized images of posts"
|
||||
task :generate_preview => :environment do
|
||||
Post.where("image_width > ?", Danbooru.config.small_image_width).find_each do |post|
|
||||
if post.is_image?
|
||||
if post.is_image? && !File.exists?(post.preview_file_path)
|
||||
puts "resizing preview #{post.id}"
|
||||
Danbooru.resize(post.file_path, post.preview_file_path, Danbooru.config.small_image_width, Danbooru.config.small_image_width, 90)
|
||||
end
|
||||
@@ -32,19 +32,10 @@ namespace :images do
|
||||
desc "Generate large-sized images of posts"
|
||||
task :generate_large => :environment do
|
||||
Post.where("image_width > ?", Danbooru.config.large_image_width).find_each do |post|
|
||||
if post.is_image?
|
||||
if post.is_image? && !File.exists?(post.large_file_path)
|
||||
puts "resizing large #{post.id}"
|
||||
Danbooru.resize(post.file_path, post.large_file_path, Danbooru.config.large_image_width, nil, 90)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Distribute large posts to other servers"
|
||||
task :distribute_large => :environment do
|
||||
Post.where("image_width > ?", Danbooru.config.large_image_width).find_each do |post|
|
||||
if post.is_image?
|
||||
puts "distributing large #{post.id}"
|
||||
RemoteFileManager.new(post.large_file_path).distribute
|
||||
post.distribute_files
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user