【问题标题】:react native camera roll .heic files反应原生相机胶卷 .heic 文件
【发布时间】:2018-02-21 12:58:12
【问题描述】:

IOS 11 上的新 .HEIC 文件会导致问题,因为图像托管服务不支持它。

相机胶卷 API 正在返回 .HEIC 文件。我们怎样才能得到 .JPG/.PNG 代替。或将 .HEIC 转换为 .JPG/.PNG

【问题讨论】:

  • 也许您可以为此使用转换器?

标签: reactjs react-native ios11 camera-roll


【解决方案1】:
ImagePicker.showImagePicker(options, imgResponse => {

this.setState({ imageLoading: true, avatarMediaId: null });

if ((imgResponse.didCancel) || (imgResponse.error)) {
    this.setState({ imageLoading: false });
} else {
    let source = {};
    let fileName = imgResponse.fileName;
    if (Platform.OS === 'ios' && (fileName.endsWith('.heic') || fileName.endsWith('.HEIC'))) {
        fileName = `${fileName.split(".")[0]}.JPG`;
    }
    source = { uri: imgResponse.uri, fileName };
    this.uploadImage(source);
}});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-08
    • 2019-01-23
    • 1970-01-01
    • 2017-09-06
    • 1970-01-01
    • 2021-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多