Skip to content

Latest commit

 

History

History
177 lines (101 loc) · 4.69 KB

api-image.rst

File metadata and controls

177 lines (101 loc) · 4.69 KB

Image API

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.

Image API Class

Basic Usage:

use Swader\Diffbot\Diffbot;

$url = 'http://some-article-to-process.com';

$diffbot = new Diffbot('my_token');
$api = $diffbot->createImageApi($url);

setMentions

setFaces

setOcr

Image Entity Class

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.

getType

getHeight

getWidth

getNaturalHeight

getNaturalWidth

getUrl

getAnchorUrl

getXPath

getMentions

getFaces

getOcr