fix add photo in publication on mobile view

This commit is contained in:
tiago.kayaya
2021-12-13 09:51:57 +01:00
parent b18aa83bfa
commit 22d079acbc
3 changed files with 23 additions and 23 deletions
@@ -22,13 +22,13 @@
</div>
</div>
</div>
<div *ngIf="capturedImage != '' " class="ion-item-container-no-border">
<ion-label class="attached-title">Fotografia Anexada </ion-label>
<ion-item lines="none">
<ion-thumbnail slot="start">
<ion-img [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage" (click)="imageSize(capturedImage)" ></ion-img>
<ion-row>
<ion-col>
@@ -74,8 +74,8 @@
</ion-label>
</div>
<!-- <div class="ion-item-container-no-border">
<ion-label (click)="selectImage()" class="cursor-pointer">
<div class="ion-item-container-no-border">
<ion-label (click)="laodPicture()" class="cursor-pointer">
<div class="attach-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-add-photos.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-add-photos.svg"></ion-icon>
@@ -83,8 +83,8 @@
<div class="attach-document cursor-pointer">
<ion-label>Anexar Fotografia</ion-label>
</div>
</ion-label>
</div> -->
</ion-label>
</div>
</div>
</div>
@@ -107,24 +107,24 @@ export class NewPublicationPage implements OnInit {
}
async takePicture() {
const image = await Camera.getPhoto({
const capturedImage = await Camera.getPhoto({
quality: 90,
allowEditing: false,
width:50,
height: 50,
// allowEditing: true,
resultType: CameraResultType.Uri,
source: CameraSource.Camera // Camera, Photos or Prompt!
source: CameraSource.Camera
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
if (image) {
this.saveImage(image)
this.photos.unshift({
filepath: "soon...",
webviewPath: capturedImage.webPath
});
this.capturedImage = await this.convertBlobToBase64(blob);
this.capturedImageTitle = new Date().getTime() + '.jpeg';
//console.log(this.capturedImage);
}
}
imageSize(image) {
var canvas = document.createElement('canvas');
@@ -139,7 +139,7 @@ export class NewPublicationPage implements OnInit {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
resolve(reader.result);
};
reader.readAsDataURL(blob);
});
@@ -148,7 +148,7 @@ export class NewPublicationPage implements OnInit {
async laodPicture() {
const capturedImage = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Camera,
source: CameraSource.Photos,
quality: 90,
width: 1080,
height: 720,
@@ -506,10 +506,10 @@ export class NewPublicationPage implements OnInit {
/* compressImage() {
let image = this.capturedImage;
this.imageCompress.compressFile(image, orientation, 50, 50,).then(() => {
this.imgResultBeforeCompress = image;
console.log('Size in bytes was:', this.imageCompress.byteCount(image));
this.imageCompress.compressFile(image, orientation, 50, 50).then(
result => {
this.imgResultAfterCompress = result;
@@ -309,7 +309,7 @@ export class NewPublicationPage implements OnInit {
clear(){
this.capturedImage = '';
}
setTitle(){
if(this.publicationType == '1') {
this.publicationTitle = 'Nova Publicação Rápida';