Generating Website Screenshot Using WordPress API

I have always noticed that whenever I mouse over a commentator’s website URL while moderating comments, I am shown a screenshot of the website.
Website screenshot in WordPress comment
Few days ago, I decided to use Google chrome inspection tool to inspect the screenshot html image code. Below is the code result;

http://s0.wordpress.com/mshots/v1/http%3A%2F%2Fw3guy.com?w=600

Changing the https://w3guy.com encoded URL above to any other URL will generate a screenshot of that web page. Also take cognizance of the fact that changing the value of w from 600 to any integer will alter the screenshot width (measured in pixels).

Say you want to embed the screenshot of a web page in your website, just pass the WordPress.com screenshot URL to src attribute of HTML image. For example:



<img src="http://s0.wordpress.com/mshots/v1/http%3A%2F%2Fw3guy.com?w=600" />

Most times, it takes a while for the tool to generate the website screenshot. If you are seeing a preview image instead of the actual image, just be patient and check later.

Confused? Check out this my simple Screenshot generator based on the WordPress.com screenshot API.

Yours truly..
Agbonghama Collins

Don’t miss out!
Subscribe to My Newsletter
Invalid email address