PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 6, 2022

[FIXED] How to display image pointed by URL in Rails

 May 06, 2022     image, ruby, ruby-on-rails     No comments   

Issue

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?


Solution

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"


Answered By - Kevin Sylvestre
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing