Closed 81867370 closed 2 years ago
$disk = Storage::disk('cosv5');
// create a file
$disk->put('avatars/1', $fileContents, ['params' => [
'ContentType' => 'image/png',
]]);
available parameters, see https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/Qcloud/Cos/Service.php#L1191
I'm going to add the request header Pic-Operations: {"is_pic_info":1,"rules":[{"fileid":"test.jpg","rule":"imageView2/format/png"}]}
Am I going to write it like this `$disk = Storage::disk('cosv5');
// create a file $disk->put('avatars/1', $fileContents, ['params' => [ 'Pic-Operations' => ["is_pic_info"=>1,"rules"=>[["fileid"=>"test.jpg","rule"=>"imageView2/format/png"]]], ]]);`
try
$disk = Storage::disk('cosv5');
// create a file
$disk->put('avatars/1', $fileContents, ['params' => [
'PicOperations' => '{"is_pic_info":1,"rules":[{"fileid":"test.jpg","rule":"imageView2/format/png"}]}',
]]);
Thank you very much for your help, your code can be implemented.I also have a question, how to judge whether the file has been uploaded successfully? It seems that there is no information returned, so we can only judge by try
catch
if fail, put
only returns false
I want to use it with the qcloud-documents interface. I need to customize the request header.
flysystem-qcloud-cos-v5
How do I add it