IMGKit
IMGKit copied to clipboard
IMGKit on Heroku makes white print screen
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
Does somebody know how to fix this issue with HEROKU and IMGKit
I'm getting this too :(
Same problem here
Did anyone ever find a resolution to this?
I had a similar issue (working locally but not on prod/heroku).
wkhtmltoimage-binary didn't seem to like requesting urls that were https. I fetched content then passed imgkit the html and was able to render.
wkhtmltoimage-binary didn't seem to like requesting urls that were https
Switched all image urls from https to http and it started working. 3 years later this answer helped me solve the issues with Heroku. Thank you @dunckr!