我目前正在创建使用Phonegap (Cordova) camera plugin的移动应用程序的过程。它正确捕获图像并将其显示在我想要的位置,但我似乎无法设置targetWidth和targetHeight选项,如上所述。设置相机的宽度和高度phonegap相机
targetWidth:以像素为单位的缩放图像的宽度。必须与 targetHeight一起使用。长宽比保持不变。 (数量)
targetHeight:以像素为单位的高度来缩放图像。必须与 targetWidth一起使用。长宽比保持不变。 (数量)
据我所知,这将改变输出图像的宽度和高度。但是,他们似乎没有工作。
建议我在研究解决方案时发现,使用可选参数allowEdit
。在这我可以让用户选择一个预先设置的平方图像。但是,这似乎也不起作用。
查看我的代码以供参考。
camera: function() {
//Fire up the camera!
navigator.camera.getPicture(onSuccess, onFail, {
destinationType: Camera.DestinationType.DATA_URL,
allowEdit: true,
targetWidth: 512,
targetHeight: 512
});
},
无论是attemps的成功是我想要的;拍摄图像的固定宽度和高度。
如何在此图像上设置图像宽度和高度?