From b9b38ca25e46d69c82629f14071772d5b75707ae Mon Sep 17 00:00:00 2001 From: r888888888 Date: Wed, 6 Sep 2017 13:32:32 -0700 Subject: [PATCH] tweak css for responsive --- app/assets/stylesheets/specific/z_responsive.scss | 13 +++++++++---- lib/tasks/images.rake | 7 ++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/specific/z_responsive.scss b/app/assets/stylesheets/specific/z_responsive.scss index 7acdf63f3..4c3fd5121 100644 --- a/app/assets/stylesheets/specific/z_responsive.scss +++ b/app/assets/stylesheets/specific/z_responsive.scss @@ -14,7 +14,7 @@ } div#page { - padding: 0 2px; + padding: 0 0.25vw; > div /* div#c-$controller */ { > div /* div#a-$action */ { display: flex; @@ -89,17 +89,22 @@ } article.post-preview { - margin: 0 0 10px 0; - width: 48vw; + margin: 0 0 0.5vw 0; + width: 49.5vw; + height: 48.5vw; text-align: center; vertical-align: middle; display: inline-block; + border: none; a { - width: 48vw; + width: 49vw; display: block; margin: 0 auto; } img { + object-fit: contain; + width: 48.5vw; + height: 48.5vw; margin: 0 auto; } } diff --git a/lib/tasks/images.rake b/lib/tasks/images.rake index 7b93fb0d7..a21687d2a 100644 --- a/lib/tasks/images.rake +++ b/lib/tasks/images.rake @@ -107,10 +107,11 @@ 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? && !File.exists?(post.preview_file_path) + width = 200 + Post.where("image_width > ?", width).find_each do |post| + 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) + Danbooru.resize(post.file_path, post.preview_file_path, width, width, 90) end end end