【发布时间】:2015-01-04 04:09:11
【问题描述】:
我正在使用以下
phonegap 3.6.0-0.21.18
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
我需要在 phonegap 中将图像本地裁剪为宽度:650 像素和高度:250 像素的固定尺寸。我用来实现它的调用如下所示。出于某种原因,当目标类型为 DATA_URL 时,phonegap 认为不需要使用相机启动裁剪工具。
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
quality: 45,
allowEdit: true, <-- Forces the crop tool to appear if target sizes are different
targetWidth: 650,
targetHeight: 250,
destinationType: destinationType.DATA_URL, <--- Changed this to work
sourceType : Camera.PictureSourceType.CAMERA,
correctOrientation: true
});
但是当我用相机更改destinationType:destinationType.FILE_URI 时,裁剪工具会在照片拍摄后打开以进行裁剪。
当我用画廊和相同的参数尝试它时,会出现裁剪工具
navigator.camera.getPicture(onPhotoURISuccess, onFail, {
quality: 45,
allowEdit: true, <-- Forces the crop tool to appear if target sizes are different
targetWidth: 650,
targetHeight: 250,
destinationType: destinationType.DATA_URL, <-- Didnt have to change for the crop tool to open
sourceType: pictureSource.SAVEDPHOTOALBUM,
mediaType : Camera.MediaType.PICTURE,
correctOrientation: true
});
我不明白相机和图库调用之间的区别。两个代码都使用目标类型作为destinationType.DATA_URL。对于相机,裁剪工具不会打开,而对于图库,它会打开。这是android或phonegap中的一些错误吗?
【问题讨论】:
标签: android cordova android-camera phonegap-plugins cordova-3