Android 使用allowEdit标志在phonegap中本机剪切图像
我正在使用下面的Android 使用allowEdit标志在phonegap中本机剪切图像,android,cordova,android-camera,phonegap-plugins,cordova-3,Android,Cordova,Android Camera,Phonegap Plugins,Cordova 3,我正在使用下面的 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 3.6.0-0.21.18 我需要在phonegap中以
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 3.6.0-0.21.18
我需要在phonegap中以本机方式将图像裁剪为固定尺寸,宽度为650px,高度为250px。我用来实现它的调用如下所示。由于某些原因,当目标类型为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
});
navigator.camera.getPicture(onPhotoDataSuccess,onFail,{
质量:45,
allowEdit:true,我认为javascript中存在性能问题。我没有尝试本机裁剪图像,但iOS中存在内存问题。我捕获base64字符串(数据URL)并使用javascript插件对其进行编辑。我想您也需要base64图像。否则,文件URI更好
看看这个,也许对你有帮助
本科尔多瓦文件:
注意:较新设备上的照片分辨率相当好。已选择照片
从设备的画廊没有缩小规模,以较低的质量,甚至
如果指定了质量参数。为了避免常见的内存问题,
将Camera.destinationType设置为文件\u URI而不是数据\u URL
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
});