Following on from my previous post Xtroo – Content Extraction using PHP, about grabbing article content via Xtroo, it has now had support for Image grabbing added. The idea being that we may want to capture a screenshot of the current state of a webpage rather than the actual content. This allows us to nicely picture the changes of a website over time for example.
Grabbing the image follows the same method as the actual article body, but using the getImage function on the xtroo object rather than getArticle. This example is written in PHP but other integrations will follow the same pattern.
Usage
use Xtroo\Xtroo;
$Xtroo = new Xtroo(‘my_token’);
$data = $Xtroo->getImage(‘…..’);$Image = $data->image
This image can then be saved into disk, loaded into GD or your favourite image manipulation library and adjusted to suit your needs.
For more information about Xtroo, check out https://xtroo.io