This commit is contained in:
Peter Maquiran
2021-08-23 16:06:05 +01:00
parent 52d5ff89c8
commit 71b80ae375
3 changed files with 24 additions and 6 deletions
@@ -15,6 +15,8 @@ import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ThemePalette } from '@angular/material/core';
import { formatDate } from 'src/plugin/momentG.js'
import { FileLoaderService } from 'src/app/services/file/file-loader.service';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
@Component({
selector: 'app-new-publication',
@@ -66,6 +68,8 @@ export class NewPublicationPage implements OnInit {
private publications: PublicationsService,
private camera: Camera,
private toastService: ToastService,
private fileLoaderService: FileLoaderService,
private fileToBase64Service: FileToBase64Service
) {
this.publicationType = this.navParams.get('publicationType');
@@ -100,6 +104,22 @@ export class NewPublicationPage implements OnInit {
});
}
laodPicture() {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
})
input.onchange = async () => {
const file = this.fileLoaderService.getFirstFile(input)
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name
};
}
getPicture() {
const options: CameraOptions = {
quality: 90,