diff --git a/app/javascript/src/styles/specific/posts.scss b/app/javascript/src/styles/specific/posts.scss index c657cc29d..1412f86be 100644 --- a/app/javascript/src/styles/specific/posts.scss +++ b/app/javascript/src/styles/specific/posts.scss @@ -430,12 +430,19 @@ div#c-posts { } } -body[data-post-current-image-size="large"] .image-view-large-link, -body[data-post-current-image-size="original"] .image-view-original-link, +body[data-post-current-image-size="large"] #post-options .image-view-large-link, +body[data-post-current-image-size="original"] #post-options .image-view-original-link, body[data-post-current-image-size="original"] #image-resize-notice { display: none; } +/* Always show the "Resized to X% of original" notice on mobile when it exists. */ +#image-resize-notice { + @media screen and (max-width: 660px) { + display: block !important; + } +} + body.mode-translation .note-container { cursor: crosshair; } diff --git a/app/models/post.rb b/app/models/post.rb index 1d2121e50..df3289998 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -269,6 +269,7 @@ class Post < ApplicationRecord end def resize_percentage + return 100 if image_width.to_i == 0 100 * large_image_width.to_f / image_width.to_f end diff --git a/app/views/posts/partials/show/_notices.html.erb b/app/views/posts/partials/show/_notices.html.erb index 700950efa..d3119ea8f 100644 --- a/app/views/posts/partials/show/_notices.html.erb +++ b/app/views/posts/partials/show/_notices.html.erb @@ -67,7 +67,7 @@ <% end %> -<% if policy(post).visible? && post.has_large? && !post.is_ugoira? %> +<% if policy(post).visible? && post.has_large? && !post.is_ugoira? && post.resize_percentage.floor < 100 %>
Resized to <%= number_to_percentage post.resize_percentage.floor, precision: 0 %> of original (<%= link_to "view original", post.tagged_file_url, class: "image-view-original-link" %>)