bigstock/bigstock

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (0.1) of this package.

PHP Bigstock API Client

0.1 2014-12-12 16:06 UTC

This package is not auto-updated.

Last update: 2020-02-21 16:02:52 UTC


README

This repo is no longer publicly supported.

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.

Install

Install the Bigstock PHP Client with Composer.

"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.

$bigstock = new Bigstock\Bigstock('API ID', 'API Secret');

Perform a search and check for a successful result

$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;

Get detailed information about an image

$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