我使用的是rails 5.2.4上的活动存储和gem:
# Use ActiveStorage variant
gem 'rmagick', '~> 2.15', '>= 2.15.4'
gem 'mini_magick', '~> 4.8'
gem 'image_processing', '~> 0.2.3'并尝试使用
<%= image_tag photo.image.variant(resize: "1000x1000").processed.service_url, class: 'img-responsive-full' %> <%= image_tag photo.image.variant(resize: "1000x1000>").processed.service_url, class: 'img-responsive-full' %> <%= image_tag photo.image.variant(resize: "1000>x1000>").processed.service_url, class: 'img-responsive-full' %>这些方法都没有调整图像的大小或强制我想要的1000x1000尺寸,我怎么能强制图像达到这个大小呢?(我刚刚从回形针迁移到活动存储)
发布于 2021-02-02 16:18:49
添加!使其正常工作:
<%= image_tag photo.image.variant(resize: "1000x1000!"), class: 'img-responsive-full' %>虽然我找不到一个解释为什么没有它就不能调整大小。通过阅读documentation,它看起来不需要任何额外的东西就可以工作。
https://stackoverflow.com/questions/65978823
复制相似问题