800) { $newWidth = 800; $newHeight = ceil((800 * $height) / $width); $preFileName = stringUtil::uniqueFileName(); $newFile = $preFileName . ".{$type}"; $newFullPathFile = $path . $newFile; Image::thumbnail($fullPathFile, $newWidth, $newHeight)->save($newFullPathFile, ['quality' => 100]); $width = $newWidth; $height = $newHeight; $img = "/uploads/{$merchantId}/{$month}/{$date}/" . $newFile; unlink($fullPathFile); $fullPathFile = $newFullPathFile; } //生成小图 300px $smallWidth = 300; $smallHeight = ceil(($smallWidth * $height) / $width); $smallFullPathFile = $path . $preFileName . '_small.' . $type; Image::thumbnail($fullPathFile, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]); $data = business::formatUploadImg($img); $data['shortUrl'] = $img; return $data; } util::fail('上传失败!'); } }