作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

... ... @@ -287,7 +287,7 @@ class ImageController extends Controller
}else{
//TODO::上传亚马逊
$amazonS3Service = new AmazonS3Service();
$amazonS3Service->uploadFiles($files,$this->path,$fileName);
$amazonS3Service->uploadFiles($file,$this->path,$fileName);
}
//批量存储
$this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
... ...
... ... @@ -45,16 +45,16 @@ class AmazonS3Service
$key = $s3Key.'/'.$filename;
$body = fopen($files->getRealPath(), 'r');
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($body, true) . PHP_EOL, FILE_APPEND);
// try {
// $result = $this->s3->putObject([
// 'Bucket' => $this->bucket,
// 'Key' => $key,
// 'SourceFile' => $Body,
// 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改
// ]);
// return $result['ObjectURL'];
// } catch (S3Exception $e) {
// return false;
// }
try {
$result = $this->s3->putObject([
'Bucket' => $this->bucket,
'Key' => $key,
'SourceFile' => $body,
'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改
]);
return $result['ObjectURL'];
} catch (S3Exception $e) {
return false;
}
}
}
... ...