如何用Webpacker显示活动存储的图像变体?

问题描述 投票:0回答:1

我无法使用Webpacker的以下功能来显示图像 image_pack_tag:

<%= image_pack_tag("http://localhost:3000" + Rails.application.routes.url_helpers.rails_representation_url(current_user.profil_picture.variant(resize_to_limit: [50, 50]).processed, only_path: true)) %>

我核实了用

<%= "http://localhost:3000" + Rails.application.routes.url_helpers.rails_representation_url(current_user.profil_picture.variant(resize_to_limit: [50, 50]).processed, only_path: true)%>

工作。我可以访问变体,但Webpacker一直在发出这个错误信息,我无法使用Webpacker的image_pack_tag来显示图片。

Webpacker can't find http://localhost:3000/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--9959728effdbb975d843d4f452319f6363c4ceac/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwTjJrMyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--120e67a3ba1bc8800d715fbf351aea75a4993405/profile.jpg in /mnt/c/Users/lethu/Documents/apps/safe_date/public/packs/manifest.json.
ruby-on-rails ruby webpack rails-activestorage
1个回答
0
投票

我想你不能使用image_pack_tag,需要使用insted image_tag。需要使用insted image_tag

© www.soinside.com 2019 - 2024. All rights reserved.