1***@qq.com
1***@qq.com
  • 发布:2023-02-24 13:19
  • 更新:2023-09-03 16:07
  • 阅读:498

获取的微信头像清晰度非常低,该如何解决?

分类:uniCloud

使用以下程序获取用户微信头像并上传到云存储里,照片特别小。只有几KB。导致后面生成的照片特别模糊,清晰度特别低?请问该如何解决呢?烦请回答!谢谢

async onChooseAvatar(e) {  
          let avatarUrl = e.detail.avatarUrl  
          // console.log('上传前',avatarUrl)  
          //const avatarTemp = await this.getTempFile(avatarUrl)  
          const url = await this.uploadFile(avatarUrl, '用户头像' + this.formatDate() + '.jpg')  
          this.avatarImage = url;  
          let userInfo = {  
              avatarImage: this.avatarImage  
          }  
          uni.setStorageSync('user_info', userInfo);  
          this.init();  
          this.postUserInfo('微信用户', this.avatarImage, 'createImages');  
        },  
        getTempFile(str) {  
          let that = this  
          var manager = wx.getFileSystemManager()  
          return new Promise((resolve,reject) => {  
              manager.readFile({  
                  filePath: str,  
                  success(res) {  
                     resolve(res.data)  
                  }  
              })  
          })  
        },  
        async uploadFile(filePath, fileName) {  
            const result = await uniCloud.uploadFile({  
                filePath: filePath,  
                cloudPath: fileName  
            });  
            return result.fileID  
        },
2023-02-24 13:19 负责人:无 分享
已邀请:
NiceUI前端

NiceUI前端 - 全栈开发

同问

要回复问题请先登录注册