Created
February 8, 2014 06:10
-
-
Save prettymuchbryce/8877371 to your computer and use it in GitHub Desktop.
url2png example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var API_KEY = "XXX"; | |
var SECRET_KEY = "XXX"; | |
var crypto = require('crypto'); | |
var url2png = function() { | |
this.generateLink = function(url) { | |
var options = "?url="+url + "&viewport=1480x1037&thumbnail_max_width=500"; | |
var token = crypto.createHash('md5').update(options + SECRET_KEY).digest('hex'); | |
return "http://api.url2png.com/v6/"+API_KEY+"/"+token+"/png/"+options; | |
}; | |
}; | |
module.exports = new url2png(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone considering using this on a live (publicly visible or insecure) website / web application, do not include your keys via plain-text!