forked from e621ng/e621ng
Move lib/danbooru, lib/danbooru_image_resizer to app/logical.
This commit is contained in:
parent
53c351ab71
commit
efeaad25ca
@ -1,4 +1,4 @@
|
|||||||
module Danbooru
|
module DanbooruImageResizer
|
||||||
def resize(read_path, write_path, width, height, resize_quality = 90)
|
def resize(read_path, write_path, width, height, resize_quality = 90)
|
||||||
image = Magick::Image.read(read_path).first
|
image = Magick::Image.read(read_path).first
|
||||||
geometry = "#{width}x>"
|
geometry = "#{width}x>"
|
@ -71,7 +71,7 @@ class PixivUgoiraConverter
|
|||||||
file = folder.first
|
file = folder.first
|
||||||
temp_path = File.join(tmpdir, file.name)
|
temp_path = File.join(tmpdir, file.name)
|
||||||
file.extract(temp_path)
|
file.extract(temp_path)
|
||||||
Danbooru.resize(temp_path, path, Danbooru.config.small_image_width, Danbooru.config.small_image_width, 85)
|
DanbooruImageResizer.resize(temp_path, path, Danbooru.config.small_image_width, Danbooru.config.small_image_width, 85)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
class ApplicationRecord < ActiveRecord::Base
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
self.abstract_class = true
|
self.abstract_class = true
|
||||||
|
|
||||||
|
include Danbooru::Paginator::ActiveRecordExtension
|
||||||
|
|
||||||
concerning :SearchMethods do
|
concerning :SearchMethods do
|
||||||
class_methods do
|
class_methods do
|
||||||
# range: "5", ">5", "<5", ">=5", "<=5", "5..10", "5,6,7"
|
# range: "5", ">5", "<5", ">=5", "<=5", "5..10", "5,6,7"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
require "danbooru_image_resizer/danbooru_image_resizer"
|
|
||||||
require "tmpdir"
|
require "tmpdir"
|
||||||
|
|
||||||
class Upload < ApplicationRecord
|
class Upload < ApplicationRecord
|
||||||
@ -273,7 +272,7 @@ class Upload < ApplicationRecord
|
|||||||
|
|
||||||
output_path = resized_file_path_for(width)
|
output_path = resized_file_path_for(width)
|
||||||
if is_image?
|
if is_image?
|
||||||
Danbooru.resize(source_path, output_path, width, height, quality)
|
DanbooruImageResizer.resize(source_path, output_path, width, height, quality)
|
||||||
elsif is_ugoira?
|
elsif is_ugoira?
|
||||||
if Delayed::Worker.delay_jobs
|
if Delayed::Worker.delay_jobs
|
||||||
# by the time this runs we'll have moved source_path to md5_file_path
|
# by the time this runs we'll have moved source_path to md5_file_path
|
||||||
|
@ -11,3 +11,4 @@ end
|
|||||||
Delayed::Worker.default_queue_name = "default"
|
Delayed::Worker.default_queue_name = "default"
|
||||||
Delayed::Worker.destroy_failed_jobs = false
|
Delayed::Worker.destroy_failed_jobs = false
|
||||||
Delayed::Worker.plugins << DelayedJobTimeoutPlugin
|
Delayed::Worker.plugins << DelayedJobTimeoutPlugin
|
||||||
|
Delayed::Job.include(Danbooru::Paginator::ActiveRecordExtension)
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
require 'danbooru/paginator'
|
|
||||||
require 'danbooru_image_resizer/danbooru_image_resizer'
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
require "danbooru/paginator/active_record_extension"
|
|
||||||
require "danbooru/paginator/numbered_collection_extension"
|
|
||||||
require "danbooru/paginator/sequential_collection_extension"
|
|
||||||
require "danbooru/paginator/pagination_error"
|
|
||||||
|
|
||||||
ApplicationRecord.__send__(:include, Danbooru::Paginator::ActiveRecordExtension)
|
|
||||||
Delayed::Job.__send__(:include, Danbooru::Paginator::ActiveRecordExtension)
|
|
Loading…
Reference in New Issue
Block a user