GithubHelp home page GithubHelp logo

rqrcode's Introduction

Hello πŸ‘‹

I build cool stuff for web, mobile or desktop. I currently work for Kyan. In a previous life I've computed for the BBC, designed and built mountain bike parts, programmed industrial robots, and dabbled in nuclear power.

rqrcode's People

Contributors

ab avatar artfuldodger avatar bjornblomqvist avatar clord avatar ebcagadas avatar fabn avatar ferdinandrosario avatar gioele avatar hubandit avatar jekhor avatar jeremyevans avatar jonakemon avatar lmmendes avatar lorddoig avatar metaskills avatar mikerogers0 avatar mmcnickle-float avatar nickgnd avatar nickhammond avatar nofxx avatar petergoldstein avatar phoozle avatar pocke avatar rezigned avatar sime avatar smnscp avatar thbar avatar thiaguerd avatar toretore avatar whomwah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rqrcode's Issues

Saving as PNG and setting color at the same time doesnt work

I tried to save my image with color directly to a file - didnt work, the color is discarded:

image.as_png(color: 0x114163FF, file: "tmp/cache/qr_#{user.id}.png")

But this one does work (chaining methods):

image.as_png(color: 0x114163FF).save("tmp/cache/qr_#{user.id}.png")

The reason is in /lib/rqrcode/export/png.rb:108

# here is the color discarded, due to greyscale mode
if output_file
   png.save(output_file,{ :color_mode => ChunkyPNG::COLOR_GRAYSCALE, :bit_depth =>1})
end

Thanks for the great library!

UTF8 strings under Ruby 1.9.2

Generating a QR Code from a UTF8 string under Ruby 1.8.7 works fine

But under Ruby 1.9.2, the same UTF8 string creates a different looking QR code. When you scan the code, the results doen't match the original input string.

FrozenError with rqrcode

On development, been getting a "FrozenError: can't modify frozen class" when i add

require "rqrcode"

to my controller. Never got this until last week

Logo inclusion

Great gem.

I was wondering if there is a way to add a logo to the qrcode?

If not, is there the ability to leave an area in the center of the QR code white and then we could use image magic to overlay a logo in the center.

See this Snapchat examples below.
https://www.google.com/url?sa=i&url=https%3A%2F%2Fmedium.com%2F%40isabeljl%2Fsnapcodes-uncomplicated-qr-coding-d9b431206c05&psig=AOvVaw2pzdMwk1a8YdH4PiqT8fw8&ust=1607380373539000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCODLodO0uu0CFQAAAAAdAAAAABAN

Thanks for any advice in advance.
snapqrcode

RQRCode::QRCodeRunTimeError (code length overflow. (1004>976). (Try a larger size!)):

Fails for user on prod after migration sometimes. If I check the Ignore2FA then it works else doesn't.

Processing by AccountController#login as HTML
  Parameters: {"utf8"=>"βœ“", "authenticity_token"=>"5OrvYz8T87xZgpT57Kpt2MxhSL2UgRgCvxAUsrvR8T+Ym7AH1Kdu5/AB8g9f8JDMu6fBCT94kI2wLLW3oGPzEw==", "username"=>"admin", "password"=>"[FILTERED]", "login"=>"Login"}
  Current user: anonymous
Completed 500 Internal Server Error in 13ms (ActiveRecord: 8.0ms)

RQRCode::QRCodeRunTimeError (code length overflow. (1004>976). (Try a larger size!)):
  plugins/redmine_2fa/lib/redmine_2fa/patches/account_controller_patch/second_authentication_init.rb:11:in `new'
  plugins/redmine_2fa/lib/redmine_2fa/patches/account_controller_patch/second_authentication_init.rb:11:in `password_authentication'
  plugins/redmine_2fa/lib/redmine_2fa/patches/account_controller_patch/second_authentication_prepare.rb:16:in `password_authentication'
  app/controllers/account_controller.rb:205:in `authenticate_user'
  app/controllers/account_controller.rb:38:in `login'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Edit @data of RQRCode::QRCode instance

My requirement

I need to generate dynamic qr codes such that the qr code remains the same but the content i.e the url it is mapped to changes frequently

The code to generate a new QR code is @qr = RQRCode::QRCode.new('url_string')

Here @qr is an instance of RQRCode::QRCode which returns
QRCodeCore: @DaTa='url_string', @error_correct_level=2, @Version=4, @module_count=33

I am able to access @Version and other variables except @DaTa using @qr.qrcode.version


How to edit the url_string/@DaTa for a qrcode

0.9.0 does not work on unicorn

Yikes!
/usr/local/rvm/gems/ruby-2.1.5/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': No such file to load -- rqrcode (LoadError)

Had to force 0.8.0

encoding a URL?

Hello there,

Does this library support encoding URLs? The readme would imply you simply need to pass in the right flag

"The interface is simple and assumes you just want to encode a string into a QR code"

But I can't find the flag anywhere in the documentation and I see nothing in the source that indicates how I might accomplish this.

I'm probably missing something obvious.

Thanks,
Dan

Store QR Code Image to Amazon S3

How would I use this library to generate the QR Code as an Image and then store that image on S3. I have a prebuilt S3 library to store images that accepts a file and stores it in the appropriate bucket. In attempting to store the QR Code PNG I am having trouble creating the image into a file and sending it. I am able to generate the file on my local dev environment but I can't get it to send the file to AWS. Any suggestions?

Can't scan QR-Code with large data input

Hello,

I tried to generate a QR Code with a data which has a length of Β±431 characters and to export as PNG or SVG but I got two problems.

With the PNG export, I set the size equal to 200 but the QR-Code was not 200 pixel big but it used only 75% of the space and is not possible to scan it.

png = qrcode.as_png(size: 200)

With the SVG export, the quality was very nice. I used the params module_size 2 and the QR-Code was Β±200 pixel height and width but the QR-Code could not be scanned.

svg = qrcode.as_svg(module_size: 11)

At the moment, we are trying to replace in our system the Google API QRCode with rqrcode

Best regards,

Steve

Support crisp rendering so as to avoid ghosting and antialiasing

I am rendering SVGs produced by rqrcode into a canvas, and the browser is causing fine white lines around every box in the output. I've traced the issue and it seems the problem is antialiasing on internal rects of the qrcode.

The shape-rendering attribute can be used to control antialiasing. I believe setting crispEdges will greatly improve the rendering of the SVG output of rqrcode, since its output consists mainly of vertical and horizontal edges.

Canβ€˜t generate PNG without setting path.

Canβ€˜t generate PNG without setting path (default options).
It works when I setting the path when generate PNG.

require 'rqrcode'

qrcode = RQRCode::QRCode.new('http://github.com/')

png = qrcode.as_png(
resize_gte_to: false,
resize_exactly_to: false,
fill: 'white',
color: 'black',
size: 120,
border_modules: 4,
module_px_size: 6,
file: nil # path to write
)

IO.write('./test.png', png.to_s)

It didn't work.

require 'rqrcode'

qrcode = RQRCode::QRCode.new('http://github.com/')
png = qrcode.as_png(
resize_gte_to: false,
resize_exactly_to: false,
fill: 'white',
color: 'black',
size: 120,
border_modules: 4,
module_px_size: 6,
file: './test.png'
)

It works!

png.to_s 500 error

I followed the example, and when I used png.to_s, I got
Encoding::UndefinedConversionError ("\x89" from ASCII-8BIT to UTF-8):

However, I use png.to_data_url, it successfully passed to front end.

Make chunky_png dependency optional?

Would it be possible to make this runtime dependency optional when using the PNG renderer? We have no use for PNG rendering and would like to avoid taking on an extra transitive dependency since SVG is supported in all major browsers: http://caniuse.com/#feat=svg

Thanks for this gem by the way, it looks very well-maintained. :-)

Controller and View for PNG?

What do I put in my Controller and View in order to save the QR codes as PNGs? The documentation only shows how to set up a view for HTML (as seen below).

Thank you!

My Controller:

class QrCodesController < ApplicationController
  def new
  end

  def create
    
    @qr = RQRCode::QRCode.new(qr_code_params[:text], size: 4)
    
  end

private
  def qr_code_params
    params.require(:qr_code).permit(:text)
  end
end

My View:

<table class="qr-code">
<% @qr.modules.each_index do |x| %>
  <tr>
  <% @qr.modules.each_index do |y| %>
   <% if @qr.dark?(x,y) %>
    <td class="black"/>
   <% else %>
    <td class="white"/>
   <% end %>
  <% end %>
  </tr>
<% end %>
</table>

Q by NOOB: Encoding URL, Phone

This is not an issue - but an example of how to encode the URL, phone would be good.

RQRCode::QRCode.new("url,phone")

or should it be

RQRCode::QRCode.new(":url=>url,:phone=>phone")

What is the format of the input string so that the QR code can be used to auto redirect to the URL or make a call ?

Getting NoMethodError when using RQRCode

When I'm trying to render the QR-Code with the example given, I get the following error and I can't figure out why:

undefined method `is_dark?' for #RQRCode::QRCode:0x000000000707ec78

If I call the method in console it doesn't find it aswell :/.

Add logo or change color of QR codes

Hi, everyone.

I want to make some customization of generating QR codes, such as inserting a logo or changing the background color.

Do you have any idea how to do it, please show me how?

Embedding svg inside svg

Just an idea, but also could be a good refactor:

xml_tag = %{<?xml version="1.0" standalone="yes"?>}

Headers and opening closes could be in a separated method.
One use case is embedding: There's some rule that you shall not have <svg> inside <svg>.
To circunvent, I'm parsing #as_svg and using children.

Resulting image blank

This is a question.

I have not found any reference to this effect, but in testing QR code generation with a high number of characters, I have noted that consistently, past a certain quantity of characters, the image generated is a stream of #FFFFFF hashes.

If I increase the size to the image, then a proper QR code is generated.

The question is thus: when a blank image (formed by a stream of #FFFFFF characters) is generated, is this indicative that the library cannot produce a QRcode with complete data and associated error correction ?

Generating a "number" QR code

Hello,

Is there a way to produce a number QR code? It is mentioned as the QRMODE[:mode_number] hash value, but I cannot find where it is used.

Any suggestions?

Invalid QR Code Generated at Level 15 EC Level H

Level 15 with error correction set to 'h' produces an invalid QR code. All other levels seem OK. Happens with any input. Possible boundary condition? I'm using Ruby 1.9.3p0 and rQRcode 0.4.2. Have tested with ruby 1.8.7-p352 and get the same issue. Can anyone else replicate?

x and y in example code?

Correct me if I'm wrong, but don't you have the x and y variables named the wrong way around in that example code?

The method is is_dark( row, col ), so it really should be a y loop containing an x loop, with @qr.dark?(y,x) instead.

RQRCodeCore

Hi,man.I am a beginner of Ruby and am learning the source code of RQRCode, but I do not know where RQRCodeCore is defined, can you tell me?

Introduce new render method as CSS

i've implemented for our project a render method css. i did this via rails_helper

the styling is done 100% via CSS so it's fully customizable, for example having rounded data instead of just squares. different coloring, also possible. the logo is just a png that will be positioned centered. up or down scaling is done by px calculation

i can share the helper module, but i wonder, what would be the best way to integrate it into this gem? i can imagine it's useful for people who want customization. for example, look at the anchors (those squares). some of the corners are rounded (each has individual classes, so you can style them one for one)

feel free to try it out and please let me know how we could implement this as a render method

helper is: https://gist.github.com/krtschmr/9e7b297763901efbe6cf02b4cb13ae5f

i can call it like this

.row.mb-5=qr_code(instruction.to_qr, logo_size: 24)
.row.mb-5=qr_code(instruction.to_qr, level: :h)
.row.mb-5=qr_code(instruction.to_qr, width: 350, logo_size: 64, level: :h)

and it renders me

image

rubydoc broken

`undefined method `new' for nil:NilClass
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/helpers/html_helper.rb:67:in `html_markup_markdown'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/yard-redcarpet-ext-0.0.3/lib/yard/redcarpet/ext.rb:65:in `html_markup_markdown'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/helpers/html_helper.rb:41:in `htmlify'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/yard-sd-0.0.4/lib/yard-sd/sequence_diagram_mixin.rb:5:in `htmlify'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/templates/default/layout/html/setup.rb:65:in `diskfile'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:355:in `render_section'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:251:in `block (2 levels) in run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:248:in `each'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:248:in `block in run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:386:in `add_options'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:247:in `run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:269:in `block in yieldall'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:400:in `with_section'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:269:in `yieldall'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/templates/default/layout/html/layout.erb:23:in `_erb_cache_0'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:279:in `erb'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/templates/default/layout/html/setup.rb:60:in `layout'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:355:in `render_section'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:251:in `block (2 levels) in run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:248:in `each'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:248:in `block in run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:386:in `add_options'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:247:in `run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/template.rb:135:in `run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/templates/engine.rb:88:in `render'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/commands/base.rb:143:in `render'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/commands/display_file_command.rb:23:in `run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/commands/base.rb:95:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/commands/library_command.rb:65:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/commands/display_object_command.rb:16:in `run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/commands/base.rb:95:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/commands/library_command.rb:65:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/router.rb:135:in `route_docs'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/router.rb:110:in `route'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/router.rb:54:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/bundler/gems/yard-639712fc98ac/lib/yard/server/rack_adapter.rb:51:in `call'
/home/app/rubydoc.info/app.rb:379:in `block in <class:DocServer>'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1540:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1540:in `block in compile!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `[]'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `block (3 levels) in route!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:966:in `route_eval'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `block (2 levels) in route!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:987:in `block in process_route'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:in `catch'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:in `process_route'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:948:in `block in route!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:in `each'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:in `route!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1059:in `block in dispatch!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1056:in `dispatch!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `block in call!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `call!'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:870:in `call'
/home/app/rubydoc.info/app.rb:28:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/puma-2.8.1/lib/puma/rack_patch.rb:13:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:212:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:205:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:175:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1949:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `block in call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1724:in `synchronize'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1724:in `synchronize'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/puma-2.8.1/lib/puma/configuration.rb:71:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/puma-2.8.1/lib/puma/server.rb:490:in `handle_request'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/puma-2.8.1/lib/puma/server.rb:361:in `process_client'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/puma-2.8.1/lib/puma/server.rb:254:in `block in run'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/puma-2.8.1/lib/puma/thread_pool.rb:92:in `call'
/home/app/rubydoc.info/vendor/bundle/ruby/2.1.0/gems/puma-2.8.1/lib/puma/thread_pool.rb:92:in `block in spawn_thread'`

Change css so that qrcode still works with media="print"

Current version of the css in README doesn't really work when I hit "Print" in browsers, because in Print mode most browsers ignore backgrounds. So instead of a QRCode there's just empty white space. I changed css a little, it now uses borders instead of the background and works well in print mode:

td {
  border-left: solid 6px #000;
  padding: 0; 
  margin: 0; 
  width: 0px; 
  height: 6px; 
}
td.black { border-color: #000; }
td.white { border-color: #fff; }

Support for modes other than mixed

It looks like the various data modes are supported by classes such as QR8bitByte, however that seems to be the only data mode class. Could we get support for the alphanumeric type? I think it's a common use-case since a lot of QR codes just store URLs and using mixed-mode (bits) takes more space than alphanumeric in that case.

Problem SVG in PDF

Friends:
I have a QR code generation that works perfectly in the views and inspecting the terminal, but when viewing in pdf it does not show the code.

It works fine locally, I tried a new server, I have the same gems, etc.

Any ideas or help

Attributing Source

How might I provide attribution to this source when implementing a new function in an unrelated gem that uses this gem as part of its code base?

I already have a system of getting a ruby script to print off an image set up, but going to see if this poetry generator works with this QR Code gem.

Production server problem

My code works without problems locally, but when I upload the code to the production server, the qr code view in pdf does not work. I have the same versions and everything as corresponds, I even did a test in one of the views without problems, but in the creation of pdf it does not create it qr.

#Gema codigo QR gem 'rqrcode', '~> 0.9.0' gem 'rqrcode_png'

` @qrcode = RQRCode::QRCode.new("www.urlprueba.cl")

    # NOTE: showing with default options specified explicitly
    puts @qrcode.inspect
    @svg = @qrcode.as_svg(
      offset: 0,
      color: '000',
      shape_rendering: 'crispEdges',
      module_size: 3,
      standalone: true
    )`

VISTA PDF

.codigo
	= @svg.html_safe

Not able to create image

Getting the following error Encoding::UndefinedConversionError ("\x89" from ASCII-8BIT to UTF-8) on saving png image as the README shows

Change the size

Now that i am generating a QRCODE how can i change the size of it?

SVG formatting is done with style attribute instead of fill, causing strict content security policies to fail

Hi there, we're a long-time user of the RQRCode gem. Thanks for maintaining it!

Problem with CSP

In the past months we've moved to more strict CSP (content security policy) directives. In particular, the style directive conflicts with the way RQRCode implements the formatting of svg. RQRCode uses a style attribute, which conflicts with a style directive that does prohibits the use of inline styling.

For example, with the following CSP header, the svg underneath causes a CSP issue:
Content-Security-Policy: style-src 'self';

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" viewBox="0 0 390 390" shape-rendering="crispEdges"><path d="M0 0h7v7h ..." style="fill: #000" transform="translate(0,0) scale(6)"></path></svg>

If style="fill: #000" would have been replaced with fill: "#000", the CSP issue would not be raised.

Support for the fill attribute

There should be no compatibility issues with this change:

  • According to caniuse.com/svg, all browsers support the fill attribute for svg tags.
  • According to css-tricks.com, all values that are legal for the CSS fill attribute, are also legal for the svg tag fill attribute. One exception is the url(#pattern) that the CSS fill supports, which the svg tag fill does not support. For the use case of this library, I estimate this is not an issue.

The changes

I'll open up a PR with the changes, which you can review. It's just a small change.

Auto size and how to set it

Hi guys,
I've seen that in release 0.9.0 it has added support for auto selecting qrcode size up to 40 but I've also seen that the default size is 4.

what value should I use for the size property to auto select the size?

if this code is setting an auto size RQRCode::QRCode.new("http://github.com/") then when is the default value used?

Cheers

saving an png through an error

qrcode = RQRCode::QRCode.new("http://github.com/")
# With default options specified explicitly
png = qrcode.as_png(
          resize_gte_to: false,
          resize_exactly_to: false,
          fill: 'white',
          color: 'black',
          size: 120,
          border_modules: 4,
          module_px_size: 6,
          file: nil # path to write
          )
IO.write("/tmp/github-qrcode.png", png.to_s)

But through error like this
"\x89" from ASCII-8BIT to UTF-8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.