提交的内容

This commit is contained in:
2025-05-12 15:45:02 +08:00
parent 629c4750da
commit b48c692775
3043 changed files with 34732 additions and 60810 deletions

25
vendor/qcloud/cos-sdk-v5/sample/qrcode.php vendored Executable file → Normal file
View File

@ -8,12 +8,12 @@ $region = "ap-beijing"; //替换为用户的 region已创建桶归属的regio
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'scheme' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
// 二维码下载时识别
// -------------------- 1. 图片二维码识别 下载时识别 -------------------- //
$result = $cosClient->Qrcode(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
@ -21,6 +21,27 @@ try {
));
// 请求成功
print_r($result);
// -------------------- 1. 图片二维码识别 下载时识别 -------------------- //
// -------------------- 2. 图片二维码识别 上传时识别 -------------------- //
$imageQrcodeTemplate = new Qcloud\Cos\ImageParamTemplate\ImageQrcodeTemplate();
$imageQrcodeTemplate->setCover(0); // 二维码覆盖功能。可为0或1功能开启后将对识别出的二维码覆盖上马赛克默认值0
$imageQrcodeTemplate->setBarType(0); // 二维码/条形码识别功能,将对识别出的二维码/条形码 覆盖马赛克。取值为012默认值0
$imageQrcodeTemplate->setSegment(0); // 通用的切片开关参数指定是否需要切片默认值0需要切片时后台会根据图片尺寸进行切片识别
$imageQrcodeTemplate->setSize(100); // 当segment取值为1时生效默认1000像素取值范围为大于等于500的整数。当size指定的数值大于图片像素时则不进行切片直接识别
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
$picOperations->setIsPicInfo(1); // is_pic_info
$picOperations->addRule($imageQrcodeTemplate, "output.png"); // rules
$result = $cosClient->putObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'object.jpg',
'Body' => fopen('/tmp/local.jpg', 'rb'), // 本地文件
'PicOperations' => $picOperations->queryString(),
));
// 请求成功
print_r($result);
// -------------------- 2. 图片二维码识别 上传时识别 -------------------- //
} catch (\Exception $e) {
// 请求失败
echo($e);