This API is used to turn content like image galleries, Instagram posts, or image-rich articles into JSON.
For examples of data that might be returned, please see http://diffbot.com and run the Image API demo.
The Image API part of the Diffbot PHP client consists of two main classes: the API class, and the Image Entity class. We'll describe them in order. Note that the API class extends :phpSwader\\Diffbot\\Abstracts\\Api
, so be sure to read that first if you haven't already.
Basic Usage:
use Swader\Diffbot\Diffbot;
$url = 'http://some-article-to-process.com';
$diffbot = new Diffbot('my_token');
$api = $diffbot->createImageApi($url);
When the Image API is done processing a URL, the result will be an instance of :phpSwader\\Diffbot\\Entity\\EntityIterator
containing one Image Entity instance for every image found.
For an overview of the abstract class all Entities (including Image) build on, see :phpSwader\\Diffbot\\Abstracts\\Entity
.
Note that the Image entities can also be returned by the :phpSwader\\Diffbot\\Api\\Analyze
API in "image" mode, or in default mode when processing a URL that is essentially an image.