API | Description |
Image tagging | Recognizes tags in images stored in COS by using the persistent processing API. |
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; // Replace it with your real `secretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; // Replace it with your real `secretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; // Replace it with your real region information, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', // Protocol header, which is `http` by default'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->DetectLabel(array('Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket'Key' => 'exampleobject',));// Request succeededprint_r($result);} catch (\\Exception $e) {// Request failedecho($e);}
Parameter | Type | Description | Required |
Bucket | String | Bucket name in the format of BucketName-APPID | Yes |
Key | String | Object key, which is the unique identifier of the object in the bucket. For example, if an object's access endpoint is examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/doc/pic.jpg , its key is doc/pic.jpg . | Yes |
Guzzle\\Service\\Resource\\Model Object([structure:protected] =>[data:protected] => Array([RequestId] => NWQwOGRkNDdfMjJiMjU4NjRfNzVjXzEwNmVjY2M=[Key] => exampleobject[Bucket] => examplebucket-1250000000[Location] => examplebucket-1250000000.cos.ap-beijing.myqcloud.com/exampleobject[Labels] => Array([0] => Array([Confidence] => 83[Name] => Toy)[1] => Array([Confidence] => 77[Name] => Stuffed toy)[2] => Array([Confidence] => 15[Name] => Art))))
Parameter | Type | Description | Parent Node |
RequestId | String | Request ID | None |
Key | String | Object key | None |
Bucket | String | Bucket name in the format of BucketName-APPID | None |
Location | String | Address of the requested resource | None |
Labels | Array | Tag information | None |
Was this page helpful?