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 thesource
is 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".:size
will 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/ 包含应用配置及 ...
随机推荐
- Tomcat的error-page掩盖action实例化的exception
在使用Struts2+Spring+Tomcat开发的时候,为了避免骚扰用户,线上系统我们一般会定义错误处理页面.但是如果开发环境中也这么做(在web.xml定义了错误转发页面),而碰巧某个actio ...
- Linux系统发布ASP.NET项目
一.安装配置Jexus服务 注:root权限下执行,Linux版本:CentOS-7 1.安装Jexus 5.8.1 "独立版"软件 该"独立版"支持64位的C ...
- MySql采用range分区可提升查询效率
简介: RANGE分区基于一个给定的连续区间范围,早期版本RANGE主要是基于整数的分区.在5.7版本中DATE.DATETIME列也可以使用RANGE分区,同时在5.5以上的版本提供了基于非整形的R ...
- 遍历 SortedList<string, string> 中的值(可用于datatable转json)
SortedList<string, string> STK = new SortedList<string, string>();STK.Add("1", ...
- Ruby for Sketchup 贪吃蛇演示源码(naive_snake)
sketchup是非常简单易用的三维建模软件,可以利用ruby 做二次开发, api文档 http://www.rbc321.cn/api 今天在su中做了一款小游戏 贪吃蛇,说一下步骤 展示 主要思 ...
- selenium下拉框踩坑埋坑
本文来自网易云社区 作者:王利蓉 最近web端全站重构,所有的页面都大大小小都有些变动,UI就全军覆没了,用例从登录改,改到个人信息页面发现根以前的实现方式完全不一样,这可怎么解决 1.以前的实现(o ...
- 接口interface和抽象类型abstract
一.接口 接口不能被实例化 接口只能包含方法声明 接口的成员包括方法.属性.索引器.事件 接口中不能包含常量.字段(域).构造函数.析构函数.静态成员 接口中的所有成员默认为public,因此接口中不 ...
- ip addr 相关操作
1.添加ip: ip addr add 1.1.1.100/255.255.255.0 dev eth0 2.删除ip: ip addr del 1.1.1.100/255.255.255.0 dev ...
- python 进程、线程、协程感悟
进程: 感觉只是使用Process模块加以使用即可: # -*- coding: utf-8 -*- # data:2019-02-23 21:23 # user:DIY # file:thread_ ...
- iOS method swizz
1: 防止按钮在一定时间内重复响应默认1秒 // // UIButton+AvoidDoubleClick.h // 51WaywardShop // // Created by jisa on 20 ...