0

I am using IMGkit gem in my rails project. I also installed wkhtmltoimage-binary which is necessary for IMGkit to work. Both IMGkit and wkhtmltoimage-binary are installed via gemfile. Under config/initializers/imgkit.rb i have

IMGKit.configure do |config|
  config.wkhtmltoimage = '/Users/Praveen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/wkhtmltoimage-binary-0.12.2'
  config.default_format = :png
end

In apps_controller.rb

def index

kit = IMGKit.new(html, :quality => 50)

# Get the image BLOB
img = kit.to_img

# Save to a file
file = kit.to_file('/path/to/save/file2.jpg')

# send to browser (Rails - use with #caches_page)
send_data(kit.to_img, :type => "image/jpeg", :disposition => 'inline')

end

When running this i got the following error

enter image description here

Though the folder permission is 777. Any help on this to proceed. Thanks in advance.

Praveen KJ
  • 630
  • 2
  • 11
  • 22

1 Answers1

0

I figured it out myself.

No need to give the following in imgkit.rb if you install wkhtmltoimage-binary via gemfile.

config.wkhtmltoimage = '/Users/Praveen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/wkhtmltoimage-binary-0.12.2'
Praveen KJ
  • 630
  • 2
  • 11
  • 22