|
...
|
...
|
@@ -66,8 +66,8 @@ class AmazonS3Service |
|
|
|
*/
|
|
|
|
public function syncImageFiles($files)
|
|
|
|
{
|
|
|
|
$file_link = $this->fetchRemoteImage($files);
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('图片:'.$file_link, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$location = ltrim(str_replace_url($files),'/');
|
|
|
|
$file_link = $this->fetchRemoteImage($files,$location);
|
|
|
|
$key = str_replace_url($files);
|
|
|
|
try {
|
|
|
|
$context = stream_context_create([
|
|
...
|
...
|
@@ -95,7 +95,7 @@ class AmazonS3Service |
|
|
|
* @method :post
|
|
|
|
* @time :2024/1/26 12:48
|
|
|
|
*/
|
|
|
|
public function fetchRemoteImage($url, $localPath = '/tmp/file.jpg') {
|
|
|
|
public function fetchRemoteImage($url, $localPath) {
|
|
|
|
// 创建 cURL 句柄
|
|
|
|
$curl = curl_init();
|
|
|
|
// 设置 cURL 选项
|
...
|
...
|
|