我有一個解決方案,雖然它是一個黑客攻擊。
1)在你的Windows Phone項目,開WWW /插件/科爾多瓦 - 插件相機/ src目錄/ CameraProxy.js
2)求resizeImage方法,並添加以下內容:
function resizeImage(successCallback, errorCallback, file, targetWidth, targetHeight, encodingType) {
...
image.onload = function() {
var imageWidth = targetWidth,
imageHeight = targetHeight;
var canvas = document.createElement('canvas');
var storageFileName;
/* ====== INSERT THIS CODE ==== */
// Maintain aspect ratio (make sure image size is no bigger than target width/height).
if (image.width < image.height) {
var aspectRatio = image.width/image.height;
imageWidth = imageHeight * aspectRatio;
}
else {
var aspectRatio = image.width/image.height;
imageHeight = imageWidth/aspectRatio;
}
/* ====== END OF CODE ADDITION ==== */
canvas.width = imageWidth;
canvas.height = imageHeight;
注:這種變化會迷路每次重新構建應用程序的時間。然而,這可能會導致升級問題,因爲科爾多瓦可能 無法更新文件,因爲它已經被修改了。但是,這可能會導致升級問題,因爲科爾多瓦可能 無法更新文件。
來源
2015-10-14 16:37:54
Ian