fix image

This commit is contained in:
Peter Maquiran
2024-04-09 11:28:08 +01:00
parent 3600ed6cd5
commit c0390da857
3 changed files with 35 additions and 35 deletions
@@ -14,7 +14,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ThemePalette } from '@angular/material/core';
import { formatDate } from 'src/plugin/momentG.js'
import { ThemeService } from 'src/app/services/theme.service';
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { Filesystem, Directory, Encoding, FilesystemDirectory, FilesystemEncoding } from '@capacitor/filesystem';
import { NgxImageCompressService } from "ngx-image-compress";
@@ -64,7 +64,7 @@
</div>
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'"
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px; width: 69px;"></ion-img>
name="image" ngDefaultControl [src]="seleted.url" style="height: 69px; width: 69px;"></ion-img>
<video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' " width="70" height="70"
preload="metadata" webkit-playsinline="webkit-playsinline">
@@ -768,44 +768,44 @@ console.log(stringGerada);
async showCroppModal() {
// const modal = await this.modalController.create({
// component: CropImagePage,
// componentProps: {
// base64ToCroppe: this.capturedImage
// },
// cssClass: 'modal modal-desktop'
// });
const modal = await this.modalController.create({
component: CropImagePage,
componentProps: {
base64ToCroppe: this.capturedImage
},
cssClass: 'modal modal-desktop'
});
// modal.onDidDismiss().then((res) => {
// if (res) {
// this.capturedImage = res.data
// this.filecontent = true;
// this.photoOrVideo = false;
modal.onDidDismiss().then((res) => {
if (res) {
this.capturedImage = res.data
this.filecontent = true;
this.photoOrVideo = false;
// const newAttachment = new PublicationAttachmentEntity(
// {
// base64: res.data.base64ToCroppe,
// extension: 'jpeg',
// OriginalFileName: "image",
// FileType: 'image'
// }
// )
const newAttachment = new PublicationAttachmentEntity(
{
base64: res.data.base64ToCroppe,
extension: 'jpeg',
OriginalFileName: "image",
FileType: 'image'
}
)
// this.PublicationFromMvService.form.Files.push(newAttachment)
// }
// }, (error) => {
// console.log(error)
// });
this.PublicationFromMvService.form.Files.push(newAttachment)
}
}, (error) => {
console.log(error)
});
// await modal.present();
await modal.present();
let fileObject = new PublicationAttachmentEntity({
base64: this.removeTextBeforeSlash(this.capturedImage, ',') ,
extension: 'jpeg',
OriginalFileName: 'video',
FileType: 'image'
})
this.PublicationFromMvService.form.Files.push(fileObject)
// let fileObject = new PublicationAttachmentEntity({
// base64: this.removeTextBeforeSlash(this.capturedImage, ',') ,
// extension: 'jpeg',
// OriginalFileName: 'video',
// FileType: 'image'
// })
// this.PublicationFromMvService.form.Files.push(fileObject)
}
}