custom_rqrcode 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -10
  3. data/lib/custom_rqrcode.rb +5 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91c0f8ed5ebefd7c835dcaf83421aa559014f846
4
- data.tar.gz: 2596cb66a575f2c94e35af9de297a0194392a0ca
3
+ metadata.gz: aaecb1ed04425fd61cef38c6348b64d0c94211aa
4
+ data.tar.gz: 41b6fdbd834bad79c292864ba7f5ffa78fb2eab8
5
5
  SHA512:
6
- metadata.gz: 8ac82bc6f6804c945109c64b2a14c7cca7cd7d1cc9c7521f41b074036b85e8176b08d9f2697c33e69e75b828cfc5591f552fd10ea55ed23ed133a0ee30f150fd
7
- data.tar.gz: 774e9a8559c4f06d1a29a094bf0427d016bb344a70191233fff3655d392afe5575841c1999cb4f6be61d1479bb7a21b62aafa6329439b71f7654c709620e3783
6
+ metadata.gz: e23dfda6969aae5ccf3603415501fbfea34db9fa6ebe34f1b409b04ab746df0e86de1186548c5a9f757e22722b15a1dca28cb3ce133bfc4d6a68fc46ee949fdc
7
+ data.tar.gz: cced611f5b08ea4f773eb0ff285078e6803474ded6a59c14c85143be46ee0a7ed8d65e848058142e440ca23d52ab84473b20fab1872e15c2a64541334b1a2478
data/README.md CHANGED
@@ -25,7 +25,7 @@ bg_image = Rails.root.join("app").to_s + ActionController::Base.helpers.asset_pa
25
25
  respond_to do |format|
26
26
  format.html
27
27
  format.svg { render :qrcode => request.url, :level => :l, :unit => 10 }
28
- format.png { render :qrcode => request.url, :bg => bg_image, :bsize => "200x100", :gravity => "center" }
28
+ format.png { render :qrcode => request.url, :bg => bg_image, :bsize => "200x100", :gravity => "center", :geometry => "+00+20" }
29
29
  format.gif { render :qrcode => request.url }
30
30
  format.jpeg { render :qrcode => request.url }
31
31
  end
@@ -33,19 +33,20 @@ end
33
33
 
34
34
  #### Options:
35
35
 
36
- * `:size` – This controls how big the QR Code will be. Smallest size will be chosen by default. Set to maintain consistent size.
37
- * `:level` – The error correction level, can be:
36
+ * `:size` – This controls how big the QR Code will be. Smallest size will be chosen by default. Set to maintain consistent size.
37
+ * `:level` – The error correction level, can be:
38
38
  * Level `:l` 7% of code can be restored
39
39
  * Level `:m` 15% of code can be restored
40
40
  * Level `:q` 25% of code can be restored
41
41
  * Level `:h` 30% of code can be restored (default :h)
42
- * `:offset` – Padding around the QR Code (e.g. 10)
43
- * `:unit` – How many pixels per module (e.g. 11)
44
- * `:fill` – Background color (e.g "ffffff" or :white)
45
- * `:color` – Foreground color for the code (e.g. "000000" or :black)
46
- * `:bg` – Background image to be combined with QR code image (e.g. "./img/000.png")
47
- * `:bsize` – Resize background image (e.g. "300x200")
48
- * `:gravity` – Location where QR code image will be put on the background image (e.g. "center", "north", "south")
42
+ * `:offset` – Padding around the QR Code (e.g. 10)
43
+ * `:unit` – How many pixels per module (e.g. 11)
44
+ * `:fill` – Background color (e.g "ffffff" or :white)
45
+ * `:color` – Foreground color for the code (e.g. "000000" or :black)
46
+ * `:bg` – Background image to be combined with QR code image (e.g. "./img/000.png")
47
+ * `:bsize` – Resize background image (e.g. "300x200")
48
+ * `:gravity` – Location where QR code image will be put on the background image (e.g. "center", "north", "south")
49
+ * `:geometry` – Adjust the position specifically where QR code image will be located on the image (e.g. "+00+10", "-10+30")
49
50
 
50
51
  ## About
51
52
 
@@ -16,8 +16,10 @@ module RQRCode
16
16
  size = options[:size] || RQRCode.minimum_qr_size_from_string(string)
17
17
  level = options[:level] || :h
18
18
 
19
- bg = options[:bg] || false
20
- bsize = options[:bsize] || false
19
+ bg = options[:bg] || false
20
+ bsize = options[:bsize] || false
21
+ geometry = options[:geometry] || "+00+00"
22
+ gravity = options[:gravity] || "north"
21
23
 
22
24
  qrcode = RQRCode::QRCode.new(string, :size => size, :level => level)
23
25
  svg = RQRCode::Renderers::SVG::render(qrcode, options)
@@ -35,6 +37,7 @@ module RQRCode
35
37
  gravity = options[:gravity] || "north"
36
38
  image = bg_image.composite(image) do |c|
37
39
  c.gravity gravity
40
+ c.geometry geometry
38
41
  end
39
42
  end
40
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_rqrcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnson Chang