Skip to content

Instantly share code, notes, and snippets.

@prettymuchbryce
Created February 8, 2014 06:10

Revisions

  1. prettymuchbryce created this gist Feb 8, 2014.
    14 changes: 14 additions & 0 deletions url2png.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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();