Generating Website Screenshots with PHP

Posted 25th January 2016

In this post, I’m going to intro­duce a PHP pack­age I recently released for gen­er­at­ing screen­shots of web pages. It’s pretty straight­for­ward to get up-​and-​running, as I’ll demonstrate.

Why Gen­er­ate Screenshots?

There are a num­ber of rea­sons you may wish to gen­er­ate screen­shots. My moti­va­tion behind the pack­age orig­i­nally was to build a sim­ple “direc­tory” of web­sites, using screen­shots to illus­trate the sites.

Screen­shots are also use­ful in test­ing; you could even run a script to peri­od­i­cally gen­er­ate a screen­shot of one of the sites you main­tain in order to check that every­thing is ren­der­ing okay.

What are the Options?

Before I intro­duce the pack­age, it’s worth men­tion­ing that there are a num­ber of third-​party ser­vices which make it even eas­ier to gen­er­ats screen­shots such as Brow­shot, URL2PNG, Shrink the Web and Url­box — but it’s worth not­ing that these are all paid ser­vices. If you’d rather do it your­self, or do it on-​the-​cheap, you might like to try out my package.