metamaps--metamaps/app/workers/grab_map_screenshot_worker.rb
Devin Howard 68e1a8042a Added animationDone event to Metamaps.JIT.js, tried to hook into it from phantomjs, failed
still have debugging stuff in this commit. it's currently rendering the image so I can check output

It doesn't seem to be responding to the event, and it's stopped hiding the UI elements around the edge
2014-10-07 20:25:45 -04:00

18 lines
385 B
Ruby

# app/workers/grab_map_screenshot_worker.rb
class GrabMapScreenshotWorker
include Sidekiq::Worker
def perform(map_id)
imgBase64 = ''
Phantomjs.run('./script/phantomjs-save-screenshot.js', map_id.to_s) { |line|
imgBase64 << line
puts line
}
#this doesn't work yet
#map = Map.find(map_id)
#map.add_attachment(imgBase64)
#map.save!
end
end