diff --git a/src/app/pages/publications/new-publication/new-publication.page.html b/src/app/pages/publications/new-publication/new-publication.page.html index e6bb1d2fb..78b994293 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.html +++ b/src/app/pages/publications/new-publication/new-publication.page.html @@ -54,7 +54,7 @@
- +
diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index e80885009..aec77b737 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -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, diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index aca4d8ac9..404f73f20 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -46,17 +46,15 @@ export class NewPublicationPage implements OnInit { capturedImageTitle:any; constructor( - private modalController: ModalController, public photoService: PhotoService, private publications: PublicationsService, private camera: Camera, - private animationController: AnimationController, private toastService: ToastService, private fileLoaderService: FileLoaderService, private fileToBase64Service: FileToBase64Service - ) { - this.publicationTitle = 'Nova Publicação'; - } + ) { + this.publicationTitle = 'Nova Publicação'; + } ngOnInit() { if(this.publicationType == '3'){