PHP code example of cloudycity / wcs-sdk-php
1. Go to this page and download the library: Download cloudycity/wcs-sdk-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cloudycity / wcs-sdk-php example snippets
//bucketName 空间名称
//fileKey 自定义文件名
//localFile 上传文件名
//returnBody 自定义返回内容 (可选)
//userParam 自定义变量名 <x:VariableName> (可选)
//userVars 自定义变量值 <x:VariableValue> (可选)
//mimeType 自定义上传类型 (可选)
allbackUrl = '';
// 预处理
$pp->persistentOps = '<cmd>';
// token有效期
$pp->deadline = '';//单位为毫秒
$token = $pp->get_token();
$client = new Uploader($token, $userParam, $userVars, $mimeType);
$resp = $client->upload_return($localFile);
print_r($resp);
//bucketName 空间名称
//fileKey 自定义文件名
//localFile 上传文件名
ileKey == null || $fileKey === '') {
$pp->scope = $bucketName;
} else {
$pp->scope = $bucketName . ':' . $fileKey;
}
$pp->deadline = '1483027200000';
$pp->persistentOps = $cmd;
$pp->persistentNotifyUrl = $notifyUrl;
$pp->returnBody = $returnBody;
$token = $pp->get_token();
$client = new ResumeUploader($token, $userParam, $encodeUserVars, $mimeType);
$client->upload($localFile);
use Wcs\ImageProcess\ImageWatermark;
//自定义参数
//$mode = 2;
//$text = 'test';
$client = new ImageWatermark($mode, $text);
// 可选参数
//$client->dissolve = '';
//$client->font = '';
//$client->fontsize = 16;
//$client->image = '';
//$client->dx = '';
//$client->dy = '';
//$client->gravity = '';
print_r($client->exec($bucketName, $fileName, $localFile));
use Wcs\ImageProcess\ImageMogr;
$client = new ImageMogr();
//可选参数,详见wcs api的文档说明
$client->thumbnail = '!10p';
print_r($client->exec($bucketName, $fileName));
use Wcs\ImageProcess\ImageInfo;
$client = new ImageInfo();
print_r($client->imgInfo($bucketName, $fileName));
use Wcs\ImageProcess\ImageInfo;
$client = new ImageInfo();
print_r($client->imageEXIF($bucketName, $fileName));