【问题标题】:Is there any size restriction in using react-native-image-picker?使用 react-native-image-picker 有大小限制吗?
【发布时间】:2019-09-03 04:16:48
【问题描述】:

如果我需要使用react-native-image-picker 上传的图像有任何大小限制,我想这样做。因为当我尝试上传大小为 33MB 的 jpg 图像时,应用程序崩溃并显示“appName 已停止工作”。但同时我可以上传 1MB+ 大小的 png、jpeg、jpg 等扩展图片。

  ImagePicker.launchImageLibrary(options, response => {
    console.log("oooooooooo", response);
    if (response.didCancel) {
      this.refs.toast.show(Strings.string_image_cancelled);
    } else (response.error) {
      console.log("ImagePicker Error: ", response.error);
    }

看,当我尝试上传那个大文件时,我没有收到任何响应。但这在 iOS 上运行良好。

【问题讨论】:

  • 控制台中是否有堆栈跟踪或任何输出可以添加到此问题中?
  • 我已经更新了问题,请检查代码。
  • 添加了一个选项 {nodata: true} 。

标签: react-native react-native-android react-native-image-picker


【解决方案1】:

因此,基本上,在上传大图像时,库会获取大量数据以转换为 base64。因此,该应用程序似乎正在崩溃。关于设置nodata: true。该库停止将数据转换为 base 64 并且工作正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-20
    • 2021-09-28
    • 2020-09-16
    • 1970-01-01
    • 2020-03-13
    • 1970-01-01
    • 2021-12-02
    • 2020-03-02
    相关资源
    最近更新 更多