MediaFile: fix thumbnail dimension calculation.
Calculate the dimensions of thumbnails ourselves instead of letting libvips calculate them for us. This way we know the exact size of thumbnails, so we can set the right width and height for <img> tags. If we let libvips calculate thumbnail sizes for us, then we can't predict the exact size of thumbnails, because sometimes libvips rounds numbers differently than us.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<%= tag.picture do -%>
|
||||
<%= tag.source media: "(max-width: 660px)", srcset: cropped_url -%>
|
||||
<%= tag.source media: "(min-width: 660px)", srcset: post.preview_file_url -%>
|
||||
<%= tag.img class: "has-cropped-#{post.has_cropped?}", src: post.preview_file_url, style: "min-width: #{preview_dimensions[:width]}px; min-height: #{preview_dimensions[:height]}px;", title: tooltip, alt: "post ##{post.id}", crossorigin: "anonymous" -%>
|
||||
<%= tag.img class: "has-cropped-#{post.has_cropped?}", src: post.preview_file_url, style: "min-width: #{preview_width}px; min-height: #{preview_height}px;", title: tooltip, alt: "post ##{post.id}", crossorigin: "anonymous" -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if pool -%>
|
||||
|
||||
Reference in New Issue
Block a user