No commit activity in last 3 years
No release in over 3 years
Glues rQRCode together with chunky_png
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

rqrcode_png

Problem: You need to generate your own QR code images
Solution: rqrcode_png

Overview

rqrcode_png extends rqrcode, adding one simple method to instances of QRCode, #to_img. ChunkyPNG is used to generate the image itself in pure Ruby. As few assumptions are made as possible regarding the image itself.

Rewrite

fork and rewrite part of the function
1. add size border size param
2. add qrcode color param

Usage

require 'rqrcode_png'

qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h )
png = qr.to_img												# returns an instance of ChunkyPNG
png.resize(90, 90).save("really_cool_qr_image.png")

NOTE: For now, the :size of the QR code has to be 14 or less. Working on this.

Bundler

gem 'rqrcode_png'

Rails

With DragonFly

# app/models/product.rb
class Product < ActiveRecord::Base
  image_accessor :qr_code
end
# somewhere
qr_code_img = RQRCode::QRCode.new('http://www.google.com/', :size => 4, :level => :h ).to_img
@product.update_attribute :qr_code, qr_code_img.to_string
# app/controllers/products.rb
def show
	@product = Product.find(params[:id])
end
# app/views/products/show.html.erb
<%= image_tag @product.qr_code.url %>

Contributing

  • Fork the project
  • Send a pull request
  • Don't touch the .gemspec, I'll do that when I release a new version

Copyright

MIT Licence (http://www.opensource.org/licenses/mit-license.html)