refactor: adjust image loading in weather art view

- Update image link to use original blob instead of a resized variant
- Remove the resizing option for the image tag for better fidelity
- Modify CSS class for a smoother hover effect without scaling issues

This refactor improves the image loading behavior by allowing
full-resolution images to be loaded directly. The previous resizing
was limiting image quality, and this change enhances user experience
when viewing weather art.
This commit is contained in:
songtianlun 2025-02-01 14:58:51 +08:00
parent 31bd6fd74e
commit 9417358625

View File

@ -29,15 +29,15 @@
<div class="gallery" data-controller="photo-swipe-lightbox">
<div data-photo-swipe-lightbox-target="gallery" class="h-full">
<% blob = @weather_art.image_blob %>
<%= link_to rails_blob_path(blob.variant(resize_to_fit: [896, 512])),
<%= link_to rails_blob_path(blob),
data: {
pswp_src: rails_blob_url(blob),
pswp_caption: 'Weather Art',
pswp_width: 1792,
pswp_height: 1024
} do %>
<%= image_tag @weather_art.image.variant(resize_to_fill: [896, 512]),
class: "object-cover w-full h-full transition-transform scale-95 transform hover:scale-105 ease-in-out" %> <!-- 改变缩放效果 -->
<%= image_tag @weather_art.image,
class: "object-cover w-full h-full transition-transform transform hover:scale-105 ease-in-out" %> <!-- 改变缩放效果 -->
<% end %>
</div>
</div>