Official PHP package for using Shardimage application.
Install With Composer
composer require shardimage/shardimage-php
to your composer.json file and run update.
Simple examples to use the package. For more details, please read our official documentation >>>
Configuring the Client
Configure the Client with information from our website to make connection with the Shardimage API.
useshardimage\shardimagephp\auth\Client;$client=newClient(['apiKey'=>'<apiKey>', //key to use the API or the image serving'apiSecret'=>'<apiSecret>', //secret to use the API'imageSecret'=>'<imageSecret>', //secret to gain more security on image serving'cloudId'=>'<cloudId>', //default configuration for cloud ID, it can be overwritten in later usage]);
useshardimage\shardimagephp\models\cloud\IndexParams;$indexParams=newIndexParams();$indexParams->nextPageToken=0;$indexParams->projections= [ //with projections parameter, we have the chance to narrow down the returning data.IndexParams::PROJECTION_NO_BACKUP,IndexParams::PROJECTION_NO_FIREWALL,];$response=$client->getCloudService()->index($indexParams);
Manage images with API
To upload images to a cloud, or list from it, we need to use the ID of the cloud. The Shardimage PHP package is capable to upload images through single or multithreads, if you have big amount of pictures.
Hosting the uploaded images with the packgate is basically generating their URL. Using the UrlService class you can build up remote image URLs also to serve them through the Shardimage.
Practically, the Shardimage will store only the original uploaded image. Every modification, transformation, conversion will applied through URL rules or cloud settings. For further information, please check the documentation >>>