作者 lyh

gx

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