figured out phantom?

This commit is contained in:
Connor Turland 2014-10-08 03:24:08 -04:00
parent c90721ad5c
commit 7e182b8beb

View file

@ -1,14 +1,9 @@
require 'phantomjs'
# 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
}
imgBase64 = `phantomjs ./script/phantomjs-save-screenshot.js #{map_id}`
map = Map.find(map_id)
map.decode_base64(imgBase64)
end