DEPRECATED
This repo is no longer publicly supported., (*1)
bigstock-php-client
PHP Client for the Bigstock API. Full documentation is available at http://help.bigstockphoto.com/hc/en-us/articles/200303245-API-Documentation.
Self-serve signup for API accounts are available in the Partners section of Bigstock., (*2)
Install
Install the Bigstock PHP Client with Composer., (*3)
"require": {
"bigstock/bigstock": "0.1"
},
Usage
Create an instance of the Bigstock API Client by passing in your API ID and API Secret as parameters.
The client will then handle any authentication when required., (*4)
$bigstock = new Bigstock\Bigstock('API ID', 'API Secret');
$search_params = array('q'=>'dog');
$result = $bigstock->search( $search_params );
if ($result->message == 'success') {
$pages = $result->data->paging;
$images = $result->data->images;
}
Loop through search results and create HTML to display images
$html = '';
foreach( $images as $image ) {
$html .= "<img src='{$image->small_thumb->url}' title='{$image->title}' height='{$image->small_thumb->height}' width='{$image->small_thumb->width}'>";
}
echo $html;
$result = $bigstock->getImage(22411445);
if ($result->message == 'success') {
$formats = $result->data->image->formats;
$preview_url = $result->data->image->preview->url;
}
Purchase and download an image
$result = $bigstock->getPurchase(22411445, 'l');
if ($result->message == 'success') {
// Get the URL to the file to download separately
$file_url = $bigstock->getDownloadUrl($result->data->download_id);
// Or download the file directly
$file = $bigstock->download($result->data->download_id);
}
License
MIT © 2014-2017 Brent Baisley, (*5)