ShardImage SDK
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.
Once the extension is installed, simply use it in your code by :
URLs:
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);
URLs:
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);
URLs:
$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);
URLs:
$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).
URLs:
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);