Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Taking a picture

$
0
0

@hotgeart wrote:

Hi,

Don't know if it's the right category so let me know.

I'm trying to take a photo and after upload on a server. But i'm stuck at the first step.

I've this code at the moment:

app.controller('AddPhotoCtrl', function($scope, $rootScope, $http, $state, $cordovaCamera) {
    document.addEventListener("deviceready", function () {

        $scope.takePic = function() {
            var options = {
                quality: 50,
                destinationType: Camera.DestinationType.DATA_URL,
                sourceType: Camera.PictureSourceType.CAMERA,
                allowEdit: true,
                encodingType: Camera.EncodingType.JPEG,
                targetWidth: 100,
                targetHeight: 100,
                popoverOptions: CameraPopoverOptions,
                saveToPhotoAlbum: false,
                correctOrientation:true
            };

            $cordovaCamera.getPicture(options).then(function(imageData) {
                var image = document.getElementById('myImage');
                image.src = "data:image/jpeg;base64," + imageData;
                alert('OK');
                alert(image.src);
            }, function(err) {
                alert('BUG');
            });

        };

    }, false);
});

So I press on my bouton (takePic()), I take the picture and after that I've 2 boutons from android Not save or Save. Obviously I press on Save and nothing happen. I don't have the alert OK or BUG.

What I'm doing wrong ?

Thanks

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>