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

231 views Asked by At

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)
1

There are 1 answers

4
Jaap Haagmans On BEST ANSWER

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.