Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display image pointed by URL in Rails

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?

like image 393
pierrotlefou Avatar asked Apr 06 '10 06:04

pierrotlefou


1 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"
like image 191
Kevin Sylvestre Avatar answered Sep 24 '22 13:09

Kevin Sylvestre