@nataschakater wrote:
I'm building an app in Ionic and I'm having a problem with the preview image in Android. It just doesn't show. I use the plugin Cordova Camera to take and select pictures from your phone. On iPhone I do see the preview image, so there all is working fine.
Anyone has any idea why it's not working on Android?
This code is in controllers.js:
$scope.addImage = function (type) { if (type == 'take') { $scope.cam = Camera.PictureSourceType.CAMERA; } else if (type == 'select') { $scope.cam = Camera.PictureSourceType.PHOTOLIBRARY; } var options = { quality: 75, destinationType: Camera.DestinationType.DATA_URL, sourceType: $scope.cam, allowEdit: true, correctOrientation: true, encodingType: Camera.EncodingType.JPEG, targetWidth: 2000, targetHeight: 2000, popoverOptions: CameraPopoverOptions, saveToPhotoAlbum: false }; $cordovaCamera.getPicture(options).then(function (imageData) { $scope.imgURI = "data:image/jpeg;base64," + imageData; $scope.image = imageData; $scope.popover.hide(); }, function (err) { console.log(JSON.stringify(err)); }); };
And the HTML in the view:
<div class="edit-image" ng-click="popover.show($event)"> <img ng-if="imgURI && imgURI === undefined" ng-src="{{imgURI }}" /> <img ng-if="!imgURI && imgURI === undefined" src="https://example.com/noimage.jpg" /> <img ng-show="imgURI !== undefined" ng-src="{{imgURI}}" class="take_picture" /> </div>
Posts: 1
Participants: 1