我正在使用内置Camera插件的Cordova 5.0 . 我的应用程序需要将拍摄的照片上传到远程服务器,因此出于带宽和性能原因,我需要限制电话侧文件的大小 .

我使用以下相机选项来拍摄新照片:

capturePhoto: function () {
    navigator.camera.getPicture(
        function (imageData) {
            this.setState({ imageData: imageData });
            this.props.onCapture(imageData);
        }.bind(this),
        handleError,
        {
            destinationType: Camera.DestinationType.DATA_URL,
            quality: 20
        }
    );
},

这在许多设备上运行良好,来自Android手机的3000x2000像素图像在磁盘上占用大约160K . 但是在某些iPhone 5s上,质量参数似乎被忽略,导致imageData为9M为base64,6M为二进制 . 在结果文件上使用 identify 表示质量为100 .

我能想到的唯一解决方案是使用 targetHeighttargetWidth 来约束图像大小而不是质量,但有没有办法让iOS设备尊重 quality 参数?