【问题标题】:How to convert image URI to Byte[](Byte array) in React Native如何在 React Native 中将图像 URI 转换为 Byte[](Byte array)
【发布时间】:2021-08-28 15:22:10
【问题描述】:

我需要上传图片到服务器。服务器需要字节数组中的图像。我正在使用react-native-image-picker 从设备中选择图像。它返回 URI(图像路径),我需要将其转换为字节数组。有没有办法将图像路径转换为字节数组?

【问题讨论】:

    标签: image react-native file-upload react-native-image-picker


    【解决方案1】:

    react-native-image-picker 提供 base64 字符串选项。将 includeBase64 属性设置为 true。您将得到 base64 编码的字符串作为响应。

    【讨论】:

      猜你喜欢
      • 2023-01-21
      • 2019-04-04
      • 2017-05-04
      • 2014-07-21
      • 2014-04-18
      • 1970-01-01
      • 2013-06-26
      • 2020-04-27
      • 1970-01-01
      相关资源
      最近更新 更多