Skip to content

Watchwolf/canicompet-file-camera

Repository files navigation

README

The component canicompet-file-camera replace the classic .

The problem with the classic is with Android :

  • When you use it on ios or on the web browser, a prompt ask the user if he wish to select a file or take a photo.
  • On Android, the prompt does not exists and Android directly open the media manager to select a file.

I have written this component to add a prompt on Android. The component act like a classic .

Feel free to copy it and modify it as your convenient.

I have created it in part of my projects : https://canicompet.com and https://canigps.fr

How do I get set up?

  1. Install Capacitor-Camera : https://capacitorjs.com/docs/apis/camera

  2. Clone the repository in your project

  3. Import the component in *.module.ts

import { CanicompetFileCameraModule } from '.../component/canicompet-file-camera/canicompet-file-camera-module';
@NgModule({
  imports: [
    ...,
    CanicompetFileCameraModule
  ],
  declarations: [...Page]
})
  1. Use it in place of
<canicompet-file-camera type="file" (ionChange)="onFileChange($event)" accept="image/*" #uploadFile/>
<ion-button slot="end" (click)="uploadFile.click($event)">
   <ion-icon name="camera"></ion-icon>
   {{ 'Take photo' | translate }}
</ion-button>
  1. Define the callback
onFileChange(fileChangeEvent: any) {
   var file = fileChangeEvent.target.files[0];
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published