gpt4 book ai didi

javascript - rails : Get the image src only

转载 作者:行者123 更新时间:2023-11-29 20:22:34 26 4
gpt4 key购买 nike

rails 是否有办法将图像的 src 作为字符串获取?我正在尝试使用 javascript 将图像嵌入第三方网站。

这是总体思路(widget.js.erb):

var widgetImage = new Image();
widgetImage.src = "<=% Some groovy ruby code to just get the image src as a string %>"

有什么想法吗?

最佳答案

是的,您正在寻找 image_path

image_path('something.png')

关于javascript - rails : Get the image src only,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3259762/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com