posts: use 180x180 thumbnails in place of 150x150 thumbnails.
For small thumbnails, use 180x180 thumbnails scaled down to 150x150. This is so we can get rid of 150x150 images and just use 180x180 for both small and medium size thumbnails. Also fix RSS feeds, XML sitemaps, and Discord embeds to use 360x360 thumbnails instead of 150x150 thumbnails.
This commit is contained in:
@@ -56,9 +56,7 @@ class PostPreviewComponent < ApplicationComponent
|
|||||||
|
|
||||||
def variant
|
def variant
|
||||||
case size
|
case size
|
||||||
when "150"
|
when "150", "180"
|
||||||
media_asset.variant("preview")
|
|
||||||
when "180"
|
|
||||||
media_asset.variant("180x180")
|
media_asset.variant("180x180")
|
||||||
when "225", "225w"
|
when "225", "225w"
|
||||||
media_asset.variant("360x360")
|
media_asset.variant("360x360")
|
||||||
|
|||||||
@@ -17,9 +17,7 @@
|
|||||||
<picture>
|
<picture>
|
||||||
<% unless save_data %>
|
<% unless save_data %>
|
||||||
<% case size %>
|
<% case size %>
|
||||||
<% when "150" %>
|
<% when "150", "180" %>
|
||||||
<%# no-op %>
|
|
||||||
<% when "180" %>
|
|
||||||
<%= tag.source type: "image/jpeg", srcset: "#{media_asset.variant("180x180").file_url} 1x, #{media_asset.variant("360x360").file_url} 2x" %>
|
<%= tag.source type: "image/jpeg", srcset: "#{media_asset.variant("180x180").file_url} 1x, #{media_asset.variant("360x360").file_url} 2x" %>
|
||||||
<% else # 225 to 360 %>
|
<% else # 225 to 360 %>
|
||||||
<%= tag.source type: "image/webp", srcset: "#{media_asset.variant("360x360").file_url} 1x, #{media_asset.variant("720x720").file_url} 2x" %>
|
<%= tag.source type: "image/webp", srcset: "#{media_asset.variant("360x360").file_url} 1x, #{media_asset.variant("720x720").file_url} 2x" %>
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class CommentsController < ApplicationController
|
|||||||
@comments = Comment.paginated_search(params)
|
@comments = Comment.paginated_search(params)
|
||||||
|
|
||||||
if request.format.atom?
|
if request.format.atom?
|
||||||
@comments = @comments.includes(:creator, :post)
|
@comments = @comments.includes(:creator, post: [:media_asset])
|
||||||
@comments = @comments.select { |comment| comment.post.visible? }
|
@comments = @comments.select { |comment| comment.post.visible? }
|
||||||
elsif request.format.html?
|
elsif request.format.html?
|
||||||
@comments = @comments.includes(:creator, :updater, post: [:uploader, :media_asset])
|
@comments = @comments.includes(:creator, :updater, post: [:uploader, :media_asset])
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ module SeoHelper
|
|||||||
name: page_title,
|
name: page_title,
|
||||||
description: meta_description,
|
description: meta_description,
|
||||||
uploadDate: post.created_at.iso8601,
|
uploadDate: post.created_at.iso8601,
|
||||||
thumbnailUrl: post.preview_file_url,
|
thumbnailUrl: post.media_asset.variant("360x360").file_url,
|
||||||
contentUrl: post.file_url,
|
contentUrl: post.file_url,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class DiscordSlashCommand
|
|||||||
if is_censored?
|
if is_censored?
|
||||||
nil
|
nil
|
||||||
elsif post.file_ext.match?(/jpe?g|png|gif/)
|
elsif post.file_ext.match?(/jpe?g|png|gif/)
|
||||||
post.file_url
|
post.media_asset.variant("original").file_url
|
||||||
else
|
else
|
||||||
post.preview_file_url
|
post.media_asset.variant("360x360").file_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ atom_feed(root_url: comments_url(host: Danbooru.config.hostname)) do |feed|
|
|||||||
feed.entry(comment, published: comment.created_at, updated: comment.updated_at) do |entry|
|
feed.entry(comment, published: comment.created_at, updated: comment.updated_at) do |entry|
|
||||||
entry.title("@#{comment.creator.name} on post ##{comment.post_id} (#{comment.post.presenter.humanized_essential_tag_string})")
|
entry.title("@#{comment.creator.name} on post ##{comment.post_id} (#{comment.post.presenter.humanized_essential_tag_string})")
|
||||||
entry.content(<<-EOS.strip_heredoc, type: "html")
|
entry.content(<<-EOS.strip_heredoc, type: "html")
|
||||||
<img src="#{comment.post.preview_file_url}"/>
|
<img src="#{comment.post.media_asset.variant("360x360").file_url}"/>
|
||||||
|
|
||||||
#{format_text(comment.body)}
|
#{format_text(comment.body)}
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<content type="xhtml">
|
<content type="xhtml">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml">
|
<div xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<%= link_to post_url(post) do %>
|
<%= link_to post_url(post) do %>
|
||||||
<%= image_tag post.preview_file_url %>
|
<%= image_tag post.media_asset.variant("360x360").file_url %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p><%= post.tag_string %></p>
|
<p><%= post.tag_string %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
<% if post.visible? %>
|
<% if post.visible? %>
|
||||||
<% if post.is_image? %>
|
<% if post.is_image? %>
|
||||||
<image:image>
|
<image:image>
|
||||||
<image:loc><%= post.file_url %></image:loc>
|
<image:loc><%= post.media_asset.variant("original").file_url %></image:loc>
|
||||||
</image:image>
|
</image:image>
|
||||||
<% elsif post.is_video? %>
|
<% elsif post.is_video? %>
|
||||||
<video:video>
|
<video:video>
|
||||||
<video:thumbnail_loc><%= post.preview_file_url %></video:thumbnail_loc>
|
<video:thumbnail_loc><%= post.media_asset.variant("360x360").file_url %></video:thumbnail_loc>
|
||||||
<video:content_loc><%= post.file_url %></video:content_loc>
|
<video:content_loc><%= post.media_asset.variant("original").file_url %></video:content_loc>
|
||||||
<video:publication_date><%= post.created_at.iso8601 %></video:publication_date>
|
<video:publication_date><%= post.created_at.iso8601 %></video:publication_date>
|
||||||
<video:title><%= "Post ##{post.id}" %></video:title>
|
<video:title><%= "Post ##{post.id}" %></video:title>
|
||||||
<video:description><%= post.tag_string %></video:description>
|
<video:description><%= post.tag_string %></video:description>
|
||||||
|
|||||||
Reference in New Issue
Block a user