rails image_tag生成图片标签
Returns an HTML image tag for thesource. The source can be a full path or a file.
Options
You can add HTML attributes using theoptions. The options supports three additionalkeys for convenience and conformance:
:alt- If no alt text is given, the file name part of thesourceis used (capitalized and without the extension):size- Supplied as "{Width}x{Height}" or "{Number}", so"30x45" becomes width="30" and height="45", and "50" becomes width="50" andheight="50".:sizewill be ignored if the value is not in thecorrect format.
Examples
image_tag("icon")
# => <img alt="Icon" src="/assets/icon" />
image_tag("icon.png")
# => <img alt="Icon" src="/assets/icon.png" />
image_tag("icon.png", size: "16x10", alt: "Edit Entry")
# => <img src="/assets/icon.png" width="16" height="10" alt="Edit Entry" />
image_tag("/icons/icon.gif", size: "16")
# => <img src="/icons/icon.gif" width="16" height="16" alt="Icon" />
image_tag("/icons/icon.gif", height: '32', width: '32')
# => <img alt="Icon" height="32" src="/icons/icon.gif" width="32" />
image_tag("/icons/icon.gif", class: "menu_icon")
# => <img alt="Icon" class="menu_icon" src="/icons/icon.gif" />
rails image_tag生成图片标签的更多相关文章
- lecture14-RBM的堆叠、修改以及DBN的决策学习和微调
这是Hinton的第14课,主要介绍了RBM和DBN的东西,这一课的课外读物有三篇论文<Self-taught learning- transfer learning from unlabele ...
- Yii的HTML助手
Html 帮助类 基础 表单 样式表和脚本 超链接 图片 列表 任何一个 web 应用程序会生成很多 HTMl 超文本标记.如果超文本标记是静态的, 那么将 PHP 和 HTML 混合在一个文件里 这 ...
- [转]Kindeditor图片粘贴上传(chrome)
原文地址:https://www.cnblogs.com/jsper/p/7608004.html 首先要赞一下kindeditor,一个十分强大的国产开源web-editor组件. kindedit ...
- KindEditor echarts
var editor; KindEditor.ready(function (K) { editor = K.create('textarea[name="content"]', ...
- kindeditor 富文本粘贴 图片
<script type="text/javascript" src="../../Scripts/Plugins/kindeditor/kindeditor.js ...
- [JS] 瀑布流加载
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name ...
- django(7)modelform操作及验证、ajax操作普通表单数据提交、文件上传、富文本框基本使用
一.modelForm操作及验证 1.获取数据库数据,界面展示数据并且获取前端提交的数据,并动态显示select框中的数据 views.py from django.shortcuts import ...
- Asp.Net Core中配置使用Kindeditor富文本编辑器实现图片上传和截图上传及文件管理和上传(开源代码.net core3.0)
KindEditor使用JavaScript编写,可以无缝的于Java..NET.PHP.ASP等程序接合. KindEditor非常适合在CMS.商城.论坛.博客.Wiki.电子邮件等互联网应用上使 ...
- YII基础
一.目录结构 应用中最重要的目录和文件(假设应用根目录是 basic): basic/ 应用根目录 composer.json Composer 配置文件, 描述包信息 config/ 包含应用配置及 ...
随机推荐
- Android中设置分割线
设置分隔线的方法一: 在需要设置分隔线的布局文件中加入如下代码: <View android:layout_width="fill_parent" andr ...
- linux系统编程之信号(二):信号处理流程(产生、注册、注销、执行)
对于一个完整的信号生命周期(从信号发送到相应的处理函数执行完毕)来说,可以分为三个阶段: 信号诞生 信号在进程中注册 信号在进程中的注销 信号处理函数执行 1 信号诞生 信号事件 ...
- abp+angular+bootstrap-table的使用
问题 materialize与bootstrap框架样式冲突 问题描述 在abp模板项目中引入bootstrap-table,列设置为checkbox,checkbox无法显示. 使用firefox浏 ...
- [Xamarin]我的Xamarin填坑之旅(二)
上一篇交代了我Xamarin填坑的背景,大概聊了聊第一步环境配置,第二步创建项目和开发框架选择.如果有一个可用的梯子,这部分基本不会出错. 接下来就具体聊一聊写代码的过程中遇到的一些事儿. 第三步是码 ...
- spring jdbc批量插入
http://blog.csdn.net/fyqcdbdx/article/details/7366439
- 敏捷项目-依赖项拖动change
1. 2.类方法插入数据.
- Linux基本命令学习与使用
1.chgrp,chown,chmod(-R递归修改文件夹下的文件) chgrp:修改文件属于哪个组 chown:修改文件属于哪个用户 chmod:修改文件权限r=4,w=2,x=1 chmod 4+ ...
- 基于jeesite+android开发 电子商务系统免费教程
下载地址: jeesite免费教程 基于jeesite+android开发 电子商务系统免费教程 基于jeesite+android开发 电子商务系统免费教程 这个教程已经录制完很久了,一直没有公开, ...
- js面试题-数组去重
今天,在聊天群里看到数组去重的话题,面试者的答案如下: 参考答案如下: 程序员思维,做出如下测试: 未考虑到:1,‘1’是不同的,应该不去重 未考虑到对象 所以,参考答案只能去重基础类型 根据以往看过 ...
- ReentrantLock获取到非公平锁的源码
/** * Performs lock. Try immediate barge, backing up to normal * acquire on failure. */ final void l ...