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

Ionic native camera, images from gallery and image from camera

$
0
0

@Rithesh4i1hu wrote:

Hi,
I want to take an image from either gallery or from a camera.
1.take pictures from camera then it is displaying all pictures properly in the application.
2.take pictures from gallery then everything is fine.
3.when an image is added from the camera and one from gallery then the image from the camera is displaying as blank(black).

image from gallery,image from gallery image from the camera is black, in b/w two images from the gallery.
why is it black, can anyone tell me why is it there like that and how to resolve that.
any help is appreciatable, thank you

this is my code :

openCamera(){
    const options:CameraOptions={
      quality:100,
      destinationType:this.camera.DestinationType.DATA_URL,
      encodingType:this.camera.EncodingType.JPEG,
      mediaType:this.camera.MediaType.PICTURE
    };
    this.camera.getPicture(options).then((imageData)=>{
      console.log(imageData);
      this.base64Image = 'data:image/jpeg;base64,'+imageData;
      this.images.push(this.base64Image);
    },err=>{
      console.log('error::',err);
    })
  }
  openGallery(){
    const options:CameraOptions={
      quality:100,
      destinationType:this.camera.DestinationType.DATA_URL,
      encodingType:this.camera.EncodingType.JPEG,
      mediaType:this.camera.MediaType.PICTURE,
      sourceType:this.camera.PictureSourceType.PHOTOLIBRARY
    };
    this.camera.getPicture(options).then((imageData)=>{
      console.log(imageData);
      this.base64Image = 'data:image/jpeg;base64,'+imageData;
    },err=>{
      console.log('error::',err);
    })
  }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70989

Trending Articles



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