[英]Rails image_path/url helper methods
I have an image in app/assets/images/portfolio/01-example.jpg我在app/assets/images/portfolio/01-example.jpg 中有一张图片
I'm not entirely sure on how to use the image_url
or image_path
helpers to display this image in the view.我不完全确定如何使用image_url
或image_path
助手在视图中显示此图像。
Is it <%= image_path('01-example.jpg') %>
?是<%= image_path('01-example.jpg') %>
吗? If anyone could correct me with the correct syntax, I'd appreciate it!如果有人能用正确的语法纠正我,我将不胜感激!
Do you want to display it in an image tag, ie is your view html?你想在图像标签中显示它,即你的视图html吗?
Then it's然后就是
<%= image_tag('portfolio/01-example.jpg') %> <%= image_tag('portfolio/01-example.jpg') %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.