gpt4 book ai didi

ios - PhoneGap iOS - 仅当照片大于 targetheight/targetwidth 时才调整相机大小

转载 作者:可可西里 更新时间:2023-11-01 06:16:22 25 4
gpt4 key购买 nike

我正在使用带有内置相机插件的 Cordova 2.0。我的应用程序包含大量上传到远程服务器的照片,出于带宽和性能原因,我必须限制手机端文件的大小。

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

    var options = {
quality : 30,
destinationType : navigator.camera.DestinationType.FILE_URI,
targetWidth: 1600,
targetHeight: 1200
}

这非常适合手机拍摄的照片,因为它们通常大于 1600x1200。但是,当我上传现有照片时,我不想将图像放大到小于目标分辨率:

    var options = {
quality : 30,
sourceType : navigator.camera.PictureSourceType.PHOTOLIBRARY,
destinationType : navigator.camera.DestinationType.FILE_URI,
targetWidth: 1600,
targetHeight: 1200
};

实际上,我总是想避免扩大规模。关于如何更改相机插件的“缩放模式”有什么想法吗?

最佳答案

根据文档,http://docs.phonegap.com/en/2.2.0/cordova_camera_camera.md.html#camera.getPicture ,无论图像质量如何,照片库中的图像都无法缩放。仅当从手机中取出时。

关于ios - PhoneGap iOS - 仅当照片大于 targetheight/targetwidth 时才调整相机大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13101255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com