This commit is contained in:
tiago.kayaya
2021-11-09 16:38:26 +01:00
parent 3a46b77e36
commit becc9796a1
4 changed files with 51 additions and 34 deletions
@@ -94,7 +94,6 @@ export class NewPublicationPage implements OnInit {
// allowEditing: true,
resultType: CameraResultType.Uri,
source: CameraSource.Camera
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
@@ -103,12 +102,9 @@ export class NewPublicationPage implements OnInit {
filepath: "soon...",
webviewPath: capturedImage.webPath
});
this.capturedImage = await this.convertBlobToBase64(blob);
this.capturedImageTitle = new Date().getTime() + '.jpeg';
//console.log(this.capturedImage);
}
convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => {
@@ -120,7 +116,28 @@ export class NewPublicationPage implements OnInit {
reader.readAsDataURL(blob);
});
laodPicture() {
async laodPicture() {
const capturedImage = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Photos,
quality: 90,
width: 1080,
height: 720,
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
this.photos.unshift({
filepath: "soon...",
webviewPath: capturedImage.webPath
});
this.capturedImage = await this.convertBlobToBase64(blob);
this.capturedImageTitle = new Date().getTime() + '.jpeg';
}
/* laodPicture() {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
})
@@ -132,8 +149,7 @@ export class NewPublicationPage implements OnInit {
this.capturedImage = imageData;
this.capturedImageTitle = file.name
};
}
} */
runValidation() {