Converting a URL to an image on Heroku with PhantomJS and ExpressJS is surprisingly easy. Just takes a little bit of finesse with Buildpacks on Heroku.
Run this experiment locally
[~] mkdir test && cd test
[~/test] git clone https://github.com/resource/lab-node-heroku-urltoimage.git .
[~/test] npm install
[~/test] foreman start
[~/test] open http://localhost:5000/render
Run this experiment on Heroku
[~/test] heroku apps:create
[~/test] heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
[~/test] heroku config:add PHANTOMJS_PATH=/app/vendor/phantomjs/bin/phantomjs
[~/test] git push heroku master
[~/test] source bin/open
Run this experiment with a custom URI
[~/test] open http://localhost:5000/render?uri=http://www.github.com/resource/lab-node-heroku-urltoimage
This repository like all other "lab-*" repositories under the Resource GitHub account are experimental in nature. They are provided as-is and updates are sparce.
2013 © Resource LLC
Licensed under the MIT License