我正在用 Cordova/Ionic 构建一个应用程序。用户可以操纵他的画廊照片,然后将其显示在应用程序上。
我现在面临的问题是,操作后,图像不会显示在 Android > 4 设备(Android 4、Android 5、Android 6 等)上。只有一个“找不到图像”的图像可见。但在 Android 2.x 设备上一切正常。
这些版本之间是否有任何重大变化?
操作是通过这个插件完成的。
我的代码如下所示(index.html)
<img src="{{!!image.img11 ? image.img11.src : 'img/layout/placeholder.png'}}" ng-cloak>
应用程序.js
navigator.camera.getPicture(onSuccess, onFail,
{
quality: 30,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
targetWidth: imagePickerWidth,
targetHeight: imagePickerHeight,
encodingType: Camera.EncodingType.PNG,
allowEdit: false
});
function onSuccess(imageURI) {
self.crop(resolve, reject, scope, imageURI, type, width, height, tabs);
/* JR-CROP MANIPULATION */
scope.image.img11 = new Image();
scope.image.img11.src = canvas.toDataURL("image/png");
}