get($url); $fp = @fopen($fullFileName, 'a'); fwrite($fp, $result); fclose($fp); Yii::info('url:' . $url); //上传oss oss::uploadImage($fileName, $fullFileName); $imgInfo = getimagesize($fullFileName); if (empty($imgInfo) || isset($imgInfo[0]) == false) { return ''; } $width = $imgInfo[0]; $height = $imgInfo[1]; //生成小图 200px $smallWidth = 200; $smallHeight = ceil((200 * $height) / $width); if ($width <= 200) { $smallWidth = $width; $smallHeight = $height; } $smallFullPathFile = $path . $middle . $middleName . '_small.jpg'; Image::thumbnail($fullFileName, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]); oss::uploadImage($middle . $middleName . '_small.jpg', $smallFullPathFile); return $fileName; } }