Using Qrio with rails. Works fine when i use it with ruby files, not working with rails

StackOverflow https://stackoverflow.com/questions/21327546

  •  02-10-2022
  •  | 
  •  

Pergunta

I want to decode QR codes in my rails app. I am using Qrio gem which needs ChunkyPng gem to work. It is working fine when i write and run a ruby program using it. But, when i try using it with Rails it does not work.

This isthe error i get.

No such file or directory - chart.png

Extracted source (around line #5): 3 4 5 6 7 8

class PNGImageLoader
  def self.load(filename)
    image = ChunkyPNG::Image.from_file(filename)

    bits = image.pixels.map do |pixel|
      grayscale = ChunkyPNG::Color.to_grayscale(pixel)
Foi útil?

Solução

It appears that the file you're trying to load doesn't exist. It seems to be looking for chart.png in your root directory. Make sure you use a full path and it will probably work.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top