我们可以在Ruby On Rails中通过HTML字符串创建Image吗? [英] Can we create an Image by HTML string in Ruby On Rails.

查看:41
本文介绍了我们可以在Ruby On Rails中通过HTML字符串创建Image吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,我们是否有可能通过具有HTML标签以及HTML格式的HTML字符串创建图像,或者来自Ruby上的Web编辑器(如Ckeditor或TinyMce等)的HTML内容,滑轨.

I would like to know , Is there any possibility by which we can create an image by the HTML sting that has the HTML tags along with the formatting Or the HTML content coming from the Web Editors like Ckeditor or TinyMce etc in Ruby on Rails.

谢谢 Nishant

Thanks Nishant

推荐答案

您指的是实现:

<%= "<img src='http://domain.tld/some_image.png' />".html_safe %>

您还可以通过插入任何字符串

You can also interpolate any strings by doing

<%= "#{url_string}".html_safe %>

其中url_string = "<img src='http://domain.tld/some_image.png' width='200px'/>"

这篇关于我们可以在Ruby On Rails中通过HTML字符串创建Image吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆