Skip to content

Instantly share code, notes, and snippets.

@danvine
Forked from prettymuchbryce/url2png.js
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danvine/8d776b9c2ca964ecec49 to your computer and use it in GitHub Desktop.
Save danvine/8d776b9c2ca964ecec49 to your computer and use it in GitHub Desktop.
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