0
カメラを呼び出し、撮影した画像のパスを取得してFTPに送信しようとしています。ngCordovaカメラImageURI画像を撮影した後に壊れた画像を表示します。
私は成功し、カメラを起動され、画像を撮影してきたchrome://inspect
GET data:image/png;base64,file:///storage/sdcard0/Android/data/com.ionicframework.camera108827/cache/1462163674353.png net::ERR_INVALID_URL
のように使用したとき、私はエラーを取得していますが、私は壊れた画像を取得しています。
ここに私の撮影画像の画像のパスを取得する私のコードです。
.controller('mycontroller',function($scope,$cordovaCamera){
$scope.takePicture = function(){
var options = {
quality : 75,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit : false,
encodingType: Camera.EncodingType.PNG,
targetWidth: 250,
targetHeight: 250,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function(imageURI) {
//$scope.image = "data:image/jpeg;base64," + imageData;
console.log('invokeing cordovaCamera');
$scope.image = "data:image/png;base64," + imageURI;
console.log($scope.image);
console.log(imageURI);
//$scope.apply();
}, function(err) {
// An error occured. Show a message to the user
});
};
});
私のindex.htmlで
<ion-content ng-controller="mycontroller">
<img ng-show="image !== undefined" ng-src="{{image}}">
<img ng-show="image === undefined" ng-src="http://placehold.it/250x250">
<button class="button" ng-click="takePicture()">Take Picture</button>
</ion-content>