Skip to content

IMGKit on Heroku makes white print screen #115

Description

@misa-itk

I am using rails api 5.2.1 and ruby 2.5.1.

My rails api application has model Location with map field which is image (carrierwave).

My goal is to make print screen of google static map and upload it to claudinary. Right not everything works fine on local. It takes print screen and upload it to claudinary storage, but when I deploy app on heroku its just make white print screen board image send it to claudinary.

My code
// config/initializers/imgkit.rb

IMGKit.configure do |config|
  config.wkhtmltoimage = Rails.root.join('bin', 'wkhtmltoimage-amd64').to_s if ENV['RACK_ENV'] == 'production'
end

// models/location.rb

def take_google_map_photo
    url = GoogleMap.generate_static_map_path(self)
    file = Tempfile.new(["location-#{id}-", '.jpg'], Rails.root.join('tmp'),
                        encoding: 'ascii-8bit')
    file.write(IMGKit.new(url,
                          'no-stop-slow-scripts': true,
                          'javascript-delay': 15000,
                          'load-error-handling': 'skip', height: 670).to_jpg)
    file.flush
    self.map = file
    save!
  end

I am getting image like this

white screen image

Does somebody know how to fix this issue with HEROKU and IMGKit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions