Last summer I had a client project that involved customers using a web application to create web sites that were themed (think hosted CMS or hosted blog), and the client wanted to provide screenshots of how the hosted site would look before the customer purchased the site and actually got access. My solution was to create a ScreenShot model that belonged to the Site model, and the screenshot images were stored via the ScreenShot model.
The fun part was that the client wanted the best-looking shots, so that meant using webkit on OSX, and the OSX box wouldn't be in the same datacenter as the servers running the web application. I ended up using Drb to send the screenshot requests to the shooter, which then used Net::HTTP to upload them back to the web application. :) It was a fun project.
I was reminded of all this when Tobi recently blogged about doing something very similar. Though my code for taking screenshots doesn't meet his requirement for it to run on Linux, I thought I'd share my code anyway for others who don't have that requirement.
As usual, I'm standing on the shoulders of giants here, as most of the heavy-lifting was done by others -- specifically, here and here. I just wrapped their code up in a handy little class I called Snapper. Enjoy!
Comments