赞
踩
首先 获取图片上传的地址和凭证 结合上一篇文章
- $imageId = self::createUpload();#获取图片上传地址和凭证
-
- $uploadAuthThree = json_decode(base64_decode($imageId->body->uploadAuth),true);
- $uploadAddressThree = json_decode(base64_decode($imageId->body->uploadAddress),true);
-
- $localFileThree = $_SERVER['DOCUMENT_ROOT'].'/uploads/20210409/eab2309c3f59974227a1dbee513b302c.png';
-
- $ossClient = self::initOssClient($uploadAuthThree,$uploadAddressThree,$localFileThree);#基于OSS原生SDK上传图片
-
-
- /**
- *获取图片上传地址和凭证
- */
- public static function createUpload(){
- $client = self::createClient("", "");
- $createUploadImageRequest = new CreateUploadImageRequest([
- "imageType" => "cover"#封面
- ]);
- // 复制代码运行请自行打印 API 的返回值
- return $client->createUploadImage($createUploadImageRequest);
- }
- $result = [
- "VideoTracks" => [#视频
- [
- "VideoTrackClips" =>[
- [
- "MediaId" => $videoId->body->videoId,
- "Effects" => [
- [
- "Type" => "Volume",
- "Gain" => "0"
- ]
- ]
- ]
- ]
- ],
- ],
- "AudioTracks" => [#音频
- [
- "AudioTrackClips" =>[
- [
- "MediaId" => $audioId->body->videoId,
- "TimelineIn" => 5
- ]
- ]
- ]
- ],
- "ImageTracks" => [#图片
- [
- "ImageTrackClips" => [
- [
- "ImageId" => $imageId->body->imageId,
- "Type" => "Image",
- "Width"=> 0.1345,
- "Height"=> 0.1678,
- "X"=> 0.1234,
- "Y"=> 0.1234,
- "TimelineIn"=>2,
- "TimelineOut"=>100
- ]
- ]
- ]
- ]
-
- ];
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。