1.0.11 • Published 5 years ago
ionictakepicture v1.0.11
Ionic Take Picture (Camera Plugin Wrapper)
This is an ionic 4 plugin to take picture from device camera. This plugin is based on ionic native camera plugin.
Disclaimer
This project was tested in ionic 4.0.0 for my personal purposes
How to use
- Install the plugin
npm install ionictakepicture
- Import and add in app.module.ts
....
import { IonictakepicturewrapperModule,IonictakepictureProvider } from 'ionictakepicture';
....
- In app.module.ts, add the module and provider to imports and providers sections
imports {
....
IonicTakePictureModule,
....
}
providers [
....
IonictakepictureProvider,
....
]
- In component.module.ts, import and export the component
...
import { IonicTakePictureModule, IonictakepictureComponent } from 'ionictakepicture';
...
imports:[
IonicTakePictureModule
]
...
exports: [
...
IonictakepictureComponent,
...
]
- Use it in respective html like this:
<ion-takepicture [(ngModel)]="pictureData"></ion-takepicture>
//Base 64 image of the pictureData
<p>{{pictureData}}</p>
- You can also use it with optional options. Detail parameter you can find on this page:
<ion-takepicture [(ngModel)]="pictureData" [targetWidth]="300" [targetHeight]="300" [saveToPhotoAlbum]="true" [cameraDirection]="0" [destinationType]="0" [encodingType]="0" [mediaType]="0" [quality]="80"></ion-takepicture>
//Base 64 image of the pictureData
<p>{{pictureData}}</p>