Giter Site home page Giter Site logo

shardimage-php's Introduction

ShardImage

ShardImage SDK

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist shardimage/shardimage-php "*"

or add

"shardimage/shardimage-php": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

Cloud

URLs:

php integration

yii integration

laravel integration

List clouds :

$cloud = new \ShardImage\Cloud(array('api_key' => $api_key, 'api_secret' => $api_secret));
$clouds = $cloud->index(array());

Create cloud :

$cloud = new \ShardImage\Cloud(array('api_key' => $api_key, 'api_secret' => $api_secret));

$parameters = array(
      'cloud' => array(
          'name' => 'Sample',
          'url_name' => $cloud->stringToURL('Sample'),
          'description' => 'Sample description',
          'enabled_domain_view' => 'The list of these domain names which allowed to serve images.',
          'enabled_domain_upload' => 'The list of these domain names which allowed from upload images.',
      )
);

$data = $cloud->store($parameters);

Show cloud :

$parameters = array(
    'cloud_id' => $cloud_id
);

$cloud = new \ShardImage\Cloud(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $cloud->show($parameters);

Modify cloud :

$parameters = array(
    'cloud_id' => $cloud_id,
    'cloud' => array(
        'name' => 'Sample',
        'url_name' => $cloud->stringToURL('Sample'),
        'description' => 'Sample description',
        'enabled_domain_view' => 'The list of these domain names which allowed to serve images.',
        'enabled_domain_upload' => 'The list of these domain names which allowed from upload images.',
    )
);
$cloud = new \ShardImage\Cloud(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $cloud->update($parameters);

Delete cloud :

$parameters = array(
    'cloud_id' => $cloud_id
);

$cloud = new \ShardImage\Cloud(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $cloud->delete($parameters);

Filter

URLs:

php integration

yii integration

laravel integration

List filters :

$filter = new \ShardImage\Filter(array('api_key' => $api_key, 'api_secret' => $api_secret));
$filters = $filter->index(array());

Create filter :

$filter = new \ShardImage\Filter(array('api_key' => $api_key, 'api_secret' => $api_secret));

$parameters = array(
      'filter' => array(
          'cloud_id' => $cloud_id,
          'name' => 'Sample',
          'url_name' => $filters->stringToURL('Sample'),
          'data' => 'List of image manipulation what need to be taken.',
      )
);

$data = $filter->store($parameters);

Show filter :

$parameters = array(
    'filter_id' => $filters_id
);

$filter = new \ShardImage\Filter(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $filter->show($parameters);

Modify filter :

$parameters = array(
    'filter_id' => $filters_id,
    'filter' => array(
        'cloud_id' => $cloud_id,
        'name' => 'Sample',
        'url_name' => $filter->stringToURL('Sample'),
        'data' => 'List of image manipulation what need to be taken.',
    )
);
$filter = new \ShardImage\Filter(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $filter->update($parameters);

Delete filter :

$parameters = array(
    'filter_id' => $filters_id
);

$filter = new \ShardImage\Filter(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $filter->delete($parameters);

Upload

URLs:

php integration

yii integration

laravel integration

$upload = new \ShardImage\Upload(array('api_key' => $api_key, 'api_secret' => $api_secret));

$parameters = array(
    'file' => $_FILES['uploadimage'],
    'parameters' => array(
        'cloud_id' => $cloud_id
    ),
);

$result = $upload->upload($parameters);

Restricted upload

URLs:

php integration

yii integration

laravel integration

$parameters = array(
    'restricted' => array(
        'cloud_id' => $cloud_id,
        'url' => 'https://www.youtube.com/watch?v=vgfLFLRXSdI'
    )
);
$restricted = new New Restricted(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $restricted->store($parameters);

Supported sites:

plus.google.com (profile photos),

facebook.com (profile photos),

twitter.com (profile photos),

vimeo.com (video frames),

youtube.com (video frames),

gravatar.com (profile photos).

Image

URLs:

php integration

yii integration

laravel integration

List images :

$image = new \ShardImage\Image(array('api_key' => $api_key, 'api_secret' => $api_secret));
$parameters = array(
    'take' => $take,
    'skip' => $skip
);
$images = $image->index($parameters);

Show image :

$parameters = array(
    'image_id' => $_id
);

$image = new \ShardImage\Image(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $image->show($parameters);

Delete Image :

$parameters = array(
    'image_id' => $_id
);

$image = new \ShardImage\Image(array('api_key' => $api_key, 'api_secret' => $api_secret));
$data = $image->delete($parameters);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.