Mobile add picture publiation and chat

This commit is contained in:
Eudes Inácio
2022-02-03 16:36:05 +01:00
parent 8e0fad9c99
commit 99b33375b8
7 changed files with 81 additions and 33 deletions
@@ -172,20 +172,23 @@ export class NewPublicationPage implements OnInit {
this.capturedImageTitle = new Date().getTime() + '.jpeg';
} */
laodPicture() {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
})
async laodPicture() {
const capturedImage = await Camera.getPhoto({
quality: 90,
// allowEditing: true,
resultType: CameraResultType.Uri,
source: CameraSource.Photos
});
input.onchange = async () => {
const file = this.fileLoaderService.getFirstFile(input)
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name
this.convertBlobToBase64Worker.postMessage(blob);
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
this.capturedImage = oEvent.data
console.log(this.capturedImage)
};
}
}