I have a image here http://power.itp.ac.cn/~jmyang/funny/fun4.jpg and I want to display it in my Rails site. How should i do that?
5 Answers
You can also use the action view image_tag helper:
<%= image_tag 'http://power.itp.ac.cn/~jmyang/funny/fun4.jpg' %>
Alternatively you can just use the regular HTML tags:
ERB:
<img src="http://power.itp.ac.cn/~jmyang/funny/fun4.jpg">
Haml:
%img{ src: "http://power.itp.ac.cn/~jmyang/funny/fun4.jpg" }
Slim:
img src="http://power.itp.ac.cn/~jmyang/funny/fun4.jpg"
1 Comment
Oinak
This works, but if there is no dinamic involved, the static version of the tag (like pierr's) shall save you some millisecons on rendering, which of course you only matter if you have millions of visitors and load is an issue.