nodeJS Website ScreenCapture
Needed to get a screenshot for a given website dynamically and return an image, not a href url.. I was curious. I could do it in php but the more i play with node the more i see room to play.
So enter this monstrosity. NodeJS Website ScreenshotMake sure you have the latest version (im always updating mistakes!)
git clone https://github.com/klexas/nodejswebsitescreenshot.git
Then you want to get onto building it. I took the time to write a package file, however lazy i was with the --save param.
And as you all know :
npm install
From here is fair game.. You pass in the url (without http afait*) its using the ossum Phantom JS to take in a url and works its own magic.
Really what happens here is nothing special. Phantom feeds back the image, and we send it back to the user.
nodejs server.js
Well Done!! That was rough maybe! :D
The next step is to use it, you're going to want to hit up your server at port 8888 or whatever trip node has thrown out at you, or if you're adventurous whatever port you decided on!
Next steps : Cleaning up this mess what i decided to upload to the raw world.
Given that you installed everything correctly! (sudo npm install) you should be ready to check it out!
Go to your domain (we will consider localhost your domain)
http://localhost:8888/google.com
You should see a screenshot of google.com