-1

I'm trying to create buttons in my Ionic app that allow the user to take a photo and then view them in the Phone Gallery.

I am able to launch the camera and take a photo using the code below. This only allows me two options: Retake Photo or Use Photo.

I do not see the thumbnail that normally display in the iPhone camera utility in the bottom left of the screen.

How do I

a.) Add the thumbnails to the bottom left like the native utility when I launch this function

OR

b.) Add a second button that at least launches the Phone Gallery to view photos

Button to launch camera:

function ($scope, $stateParams,$cordovaCamera) {
$scope.buttonClick = function() {

  var options = {
      destinationType: Camera.DestinationType.DATA_URL,
      sourceType: Camera.PictureSourceType.CAMERA,
      saveToPhotoAlbum:true

    };
Rocco The Taco
  • 3,695
  • 13
  • 46
  • 79

1 Answers1

0

You can use getPicture Method:

$scope.takePicture = function(sourceType) {
    navigator.camera.getPicture(
      function(FILE_URI) {
        // FILE_URI is the url image 
        console.log(FILE_URI)
      },
      function(e) {
        $ionicPopup.alert({
          title: "Error",
          okText: "Ok",
          template:e
        });
      },
      {
        quality: 50,
        destinationType: Camera.DestinationType.FILE_URI,
        sourceType: sourceType,
        encodingType: Camera.EncodingType.JPEG,
        mediaType: Camera.MediaType.PICTURE
      }
    );
  };
Sergio Escudero
  • 1,798
  • 14
  • 21
  • Isn't that to pass/view a single photo? I want to display the entire Photo Gallery on the device when a button is clicked just like if you clicked the thumbnail on the regular iPhone Camera utlity. – Rocco The Taco Jan 24 '18 at 21:09