|
|
@ -36,7 +36,14 @@ class Download |
|
|
|
$result = $this->curl($url); |
|
|
|
$result = $this->curl($url); |
|
|
|
empty($result) && throwError('获取到的图片内容为空 url: ' . $url); |
|
|
|
empty($result) && throwError('获取到的图片内容为空 url: ' . $url); |
|
|
|
$this->fwrite($savePath, $result); |
|
|
|
$this->fwrite($savePath, $result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//特殊处理一下文件格式为webp的图片 |
|
|
|
|
|
|
|
$mime = mime_content_type($savePath); |
|
|
|
|
|
|
|
if ($mime=='image/webp') { |
|
|
|
|
|
|
|
$im = imagecreatefromwebp($savePath); |
|
|
|
|
|
|
|
imagepng($im, $savePath); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return $savePath; |
|
|
|
return $savePath; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|