ROR的二维码插件

QRCode for Ruby on Rails

A plugin for Ruby on Rails to generate QRCode.

About

This plugin use javascript to generate QRCode. The original javascript program is developed by Kazuhiko Arase. (http://www.d-project.com/qrcode/index.html)

Usage

  1. In your rails project, install the plugin by following command:
   ./script/plugin install http://qrcode-rails.googlecode.com/svn/trunk/plugins/qrcode
Add javascript include tag in HTML header:
   <%= javascript_include_tag :defaults %>
Add following funtion to where you want to generate QRCode.
   <%= qrcode('http://www.google.com/', 2, 8, 'my-qrcode') %>
- Add following funtion to where you want to generate QRCode.
  • The first parameter is URL
  • The second optional parameter is pixel size.
  • The third optional parameter is QR Code type number, 1-10. Higher the type number, more data can be stored (max 976-2192 bits, depends on error correction level). Default 4. (For the relationship about adata size and type number, please refer to http://www.denso-wave.com/qrcode/vertable1-e.html)
  • The 4th optional parameter is ID of the generated div

Example

You can find source of an example project here: http://qrcode-rails.googlecode.com/svn/trunk/examples

I have package the sample program into a WAR, deploy it into any Web Container (e.g. Tomcat, Jetty, Glassfish ...etc) to see how it works!

Sample Code

<%= qrcode('http://www.google.com/', 8) %>

Sample Screen

License

Released under the MIT license.

Author

  • Francis Chong - siuying at reality dot hk

全文引自http://code.google.com/p/qrcode-rails/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值