Take control over when the screenshot is taken.
Checkout the Javascript over at http://codepen.io/anon/pen/pJRvvV
Take control over when the screenshot is taken.
Checkout the Javascript over at http://codepen.io/anon/pen/pJRvvV
require 'cgi' unless defined?(CGI) | |
require 'digest' unless defined?(Digest) | |
class Url2png | |
attr_reader :apikey, :secret, :query_string, :token | |
def initialize options | |
@apikey = ENV['URL2PNG_APIKEY'] | |
@secret = ENV['URL2PNG_SECRET'] | |
@query_string = options.sort.map { |k,v| "#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}" }.join("&") | |
@token = Digest::MD5.hexdigest(query_string + secret) | |
end | |
def url | |
"http://api.url2png.com/v6/#{apikey}/#{token}/png/?#{query_string}" | |
end | |
end | |
options = { | |
url: "http://codepen.io/anon/pen/pJRvvV", | |
say_cheese: true, | |
viewport: "1024x1024" | |
} | |
puts Url2png.new(options).url |