呆呆大笨熊_个人页

个人头像照片 呆呆大笨熊
个人头像照片
0
2
0

个人介绍

暂无个人介绍

擅长的技术

  • 容器
  • 数据库
获得更多能力
通用技术能力:

暂时未有相关通用技术能力~

云产品技术能力:

暂时未有相关云产品技术能力~

阿里云技能认证

详细说明
暂无更多信息
正在加载, 请稍后...
暂无更多信息
  • 回答了问题 2019-07-17

    javascript oss put base64 出现图片格式损坏

    https://yq.aliyun.com/articles/253170?spm=5176.100240.searchblog.9.8tMWIb 参考这篇文章

    // Convert a base-64 string to a byte array

      base64ToBytes (base64) {
        // Use browser-native function if it exists
        if (typeof atob === 'function') return this.stringToBytes(window.atob(base64))
        // Remove non-base-64 characters
        base64 = base64.replace(/[^A-Z0-9+/]/ig, '')
        var bytes = []
        for (var i = 0; i < base64.length; i++) {
          switch (i % 4) {
            case 1:
              bytes.push((base64map.indexOf(base64.charAt(i - 1)) << 2) |
                (base64map.indexOf(base64.charAt(i)) >>> 4))
              break
            case 2:
              bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0xF) << 4) |
                (base64map.indexOf(base64.charAt(i)) >>> 2))
              break
            case 3:
              bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0x3) << 6) |
                (base64map.indexOf(base64.charAt(i))))
              break
          }
        }
        return bytes
      },
      stringToBytes (str) {
        var bytes = []
        for (var i = 0; i < str.length; i++) {
          bytes.push(str.charCodeAt(i))
        }
        return bytes
      }
    

    一定要转成base64ToBytes

    踩0 评论0
  • 提交了问题 2017-11-29

    javascript oss put base64 出现图片格式损坏

正在加载, 请稍后...
滑动查看更多
正在加载, 请稍后...
暂无更多信息