|
|
@@ -28,6 +28,13 @@ class ImageService
|
|
|
$name = $middleName . '.jpg';
|
|
|
$fullFileName = $path . $middle . $name;
|
|
|
$fileName = $middle . $name;
|
|
|
+
|
|
|
+ $respond = oss::fileExist($fileName);
|
|
|
+ if ($respond) {
|
|
|
+ Yii::info('url' . $url . ' 已经创建过了');
|
|
|
+ return $fileName;
|
|
|
+ }
|
|
|
+
|
|
|
$curl = new curl\Curl();
|
|
|
$result = $curl->get($url);
|
|
|
|
|
|
@@ -37,7 +44,7 @@ class ImageService
|
|
|
|
|
|
Yii::info('url:' . $url);
|
|
|
//上传oss
|
|
|
- oss::uploadImage($fileName,$fullFileName);
|
|
|
+ oss::uploadImage($fileName, $fullFileName);
|
|
|
|
|
|
$imgInfo = getimagesize($fullFileName);
|
|
|
if (empty($imgInfo) || isset($imgInfo[0]) == false) {
|
|
|
@@ -56,7 +63,7 @@ class ImageService
|
|
|
$smallFullPathFile = $path . $middle . $middleName . '_small.jpg';
|
|
|
Image::thumbnail($fullFileName, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
|
|
|
|
|
|
- oss::uploadImage($middle . $middleName . '_small.jpg',$smallFullPathFile);
|
|
|
+ oss::uploadImage($middle . $middleName . '_small.jpg', $smallFullPathFile);
|
|
|
|
|
|
return $fileName;
|
|
|
}
|