Take a photo or capture video.

Requires the Cordova plugin: cordova-plugin-camera. For more info, please see the Cordova Camera Plugin Docs.

[Warning] Since IOS 10 the camera requires permissions to be placed in your config.xml add

<config-file parent="NSCameraIonic 拍照Camera插件的用法(Usage)Description" platform="ios" target="*-Info.plist">
 <string>You can take photosstring>

inside of the

Contact Us Today!

Ionic 拍照Camera插件的安装(Installation)

ionic cordova plugin add cordova-plugin-camera npm install @ionic-native/camera
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/camera

Ionic 拍照Camera插件支持的平台(Supported Platforms)

  • Android
  • Browser
  • iOS
  • Windows

Ionic 拍照Camera插件的用法(Usage)

import { Camera, CameraOptions } from '@ionic-native/camera/ngx';

constructor(private camera: Camera) { }


const options: CameraOptions = {
  quality: 100,
  destinationType: this.camera.DestinationType.FILE_URI,
  encodingType: this.camera.EncodingType.JPEG,
  mediaType: this.camera.MediaType.PICTURE

this.camera.getPicture(options).then((imageData) => {
 // imageData is either a base64 encoded string or a file URI
 // If it's base64 (DATA_URL):
 let base64Image = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
 // Handle error