From 24c53172db4cedad4af62fc4ea55694d8373e8cd Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 17 May 2020 15:01:59 -0500 Subject: [PATCH] config: remove enable_image_cropping option. There's no need to disable this option. Supporting it adds complexity and disabling it is untested. --- app/logical/danbooru_image_resizer.rb | 2 -- app/logical/pixiv_ugoira_converter.rb | 2 -- app/presenters/post_presenter.rb | 2 +- app/views/posts/partials/index/_posts.html.erb | 2 +- app/views/recommended_posts/_index.html.erb | 2 +- config/danbooru_default_config.rb | 4 ---- 6 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/logical/danbooru_image_resizer.rb b/app/logical/danbooru_image_resizer.rb index 9321ccc2d..08e17ac2b 100644 --- a/app/logical/danbooru_image_resizer.rb +++ b/app/logical/danbooru_image_resizer.rb @@ -27,8 +27,6 @@ module DanbooruImageResizer end def crop(file, width, height, resize_quality = 90) - return nil unless Danbooru.config.enable_image_cropping - output_file = Tempfile.new resized_image = Vips::Image.thumbnail(file.path, width, height: height, **CROP_OPTIONS) resized_image.jpegsave(output_file.path, Q: resize_quality, **JPEG_OPTIONS) diff --git a/app/logical/pixiv_ugoira_converter.rb b/app/logical/pixiv_ugoira_converter.rb index 51762e206..ed3fac9d7 100644 --- a/app/logical/pixiv_ugoira_converter.rb +++ b/app/logical/pixiv_ugoira_converter.rb @@ -69,8 +69,6 @@ class PixivUgoiraConverter end def self.generate_crop(ugoira_file) - return nil unless Danbooru.config.enable_image_cropping - file = Tempfile.new(["ugoira-crop", ".zip"], binmode: true) zipfile = Zip::File.new(ugoira_file.path) zipfile.entries.first.extract(file.path) { true } # 'true' means overwrite the existing tempfile. diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index 1e0097094..4940cec16 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -43,7 +43,7 @@ class PostPresenter locals[:tooltip] = "#{post.tag_string} rating:#{post.rating} score:#{post.score}" - locals[:cropped_url] = if Danbooru.config.enable_image_cropping && options[:show_cropped] && post.has_cropped? && !CurrentUser.user.disable_cropped_thumbnails? + locals[:cropped_url] = if options[:show_cropped] && post.has_cropped? && !CurrentUser.user.disable_cropped_thumbnails? post.crop_file_url else post.preview_file_url diff --git a/app/views/posts/partials/index/_posts.html.erb b/app/views/posts/partials/index/_posts.html.erb index 74f39f4c9..701415e19 100644 --- a/app/views/posts/partials/index/_posts.html.erb +++ b/app/views/posts/partials/index/_posts.html.erb @@ -1,4 +1,4 @@ -
+
<%= post_set.post_previews_html(self) %>
diff --git a/app/views/recommended_posts/_index.html.erb b/app/views/recommended_posts/_index.html.erb index 7fbf2606c..7edf76afb 100644 --- a/app/views/recommended_posts/_index.html.erb +++ b/app/views/recommended_posts/_index.html.erb @@ -1,4 +1,4 @@ -