pull made 28/08/2023 11:29

This commit is contained in:
Eudes Inácio
2023-08-28 11:29:21 +01:00
10 changed files with 64 additions and 102 deletions
@@ -20,7 +20,7 @@
<ion-slides style="width: 100%; height: 100%;" [options]="sliderOpts">
<ion-slide>
<div class="swiper-zoom-container" >
<div style="overflow: scroll; width: 100%; height:100%;">
<div style="overflow: scroll; width: 100%; height:100%;" class="d-flex justify-center">
<img src="{{image}}">
</div>
</div>
@@ -58,11 +58,12 @@
overflow: auto !important;
.media-content{
height: fit-content !important;
height: 100% !important;
overflow: auto !important;
img{
width: fit-content !important;
height: 100% !important;
max-height: 500px;
}
}
}
@@ -72,6 +73,12 @@
.media {
.media-content{
height: 100% !important;
img{
width: fit-content !important;
max-height: 555px;
}
}
}
}
@@ -20,8 +20,16 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
import { NgxImageCompressService } from "ngx-image-compress";
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
import { RouteService } from 'src/app/services/route.service';
import { FileService } from 'src/app/services/functions/file.service';
import { readAndCompressImage } from 'browser-image-resizer';
const config = {
quality: 0.5,
maxWidth: 800,
maxHeight: 600,
debug: true
};
const IMAGE_DIR = 'stored-images';
interface LocalFile {
@@ -92,6 +100,7 @@ export class NewPublicationPage implements OnInit {
private httpErrorHandle: HttpErrorHandle,
public PublicationFolderService: PublicationFolderService,
private RouteService: RouteService,
public FileService: FileService
) {
this.publicationType = this.navParams.get('publicationType');
@@ -114,6 +123,7 @@ export class NewPublicationPage implements OnInit {
// this.takePicture();
}
// in use
async takePicture() {
const capturedImage = await Camera.getPhoto({
@@ -155,6 +165,7 @@ export class NewPublicationPage implements OnInit {
});
// in use
async laodPicture() {
const capturedImage = await Camera.getPhoto({
@@ -349,93 +360,8 @@ export class NewPublicationPage implements OnInit {
}
}
async selectImage() {
const image = await Camera.getPhoto({
quality: 90,
allowEditing: false,
resultType: CameraResultType.Uri,
source: CameraSource.Camera // Camera, Photos or Prompt!
});
if (image) {
this.saveImage(image)
}
}
// Create a new file from a capture image
async saveImage(photo: Photo) {
const base64Data = await this.readAsBase64(photo);
const fileName = new Date().getTime() + '.jpeg';
const savedFile = await Filesystem.writeFile({
path: `${IMAGE_DIR}/${fileName}`,
data: base64Data,
directory: Directory.Data
});
//this.loadFiles(fileName);
this.loadFileData(fileName);
}
private async readAsBase64(photo: Photo) {
if (this.platform.is('hybrid')) {
const file = await Filesystem.readFile({
path: photo.path
});
return file.data;
}
else {
// Fetch the photo, read as a blob, then convert to base64 format
const response = await fetch(photo.webPath);
const blob = await response.blob();
return await this.convertBlobToBase64(blob) as string;
}
}
async loadFiles(fileName) {
this.images = [];
const loading = await this.loadingCtrl.create({
message: 'Loading data...',
});
await loading.present();
}
async loadFileData(fileName: string) {
const loading = await this.loadingCtrl.create({
message: 'Loading data...',
});
await loading.present();
const filePath = `${IMAGE_DIR}/${fileName}`;
const readFile = await Filesystem.readFile({
path: filePath,
directory: Directory.Data,
});
this.images.push({
name: fileName,
path: filePath,
data: `data:image/jpeg;base64,${readFile.data}`,
});
this.capturedImage = this.images[0].data
this.compressFile();
loading.dismiss();
}
compressFile() {
//this.imgResultBeforeCompress = image;s
@@ -50,9 +50,13 @@
margin: 0 auto;
border-radius: 0px!important;
overflow: hidden;
display: flex;
justify-content: center;
height: 420px;
}
.post-img img{
width: 100%;
height: 100%;
object-fit: cover;
}
@@ -128,11 +128,14 @@
margin: 0 auto;
border-radius: 0px!important;
overflow: hidden;
background-color: white;
display: flex;
justify-content: center;
}
.post-img img{
width: 100%;
height: 100%;
object-fit: cover;
max-height: 420px;
}
.post-content{
margin: 0 auto;
@@ -250,4 +250,18 @@ export class FileService {
})
}
dataURLtoFile(dataurl, filename) {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[arr.length - 1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, {type:mime});
}
}
@@ -83,9 +83,14 @@
margin: 0 auto;
border-radius: 0px!important;
overflow: hidden;
background-color: white;
display: flex;
justify-content: center;
height: 420px;
}
.post-img img{
width: 100%;
height: 100%;
object-fit: cover;
}
@@ -138,9 +138,12 @@
height: 56.25vh !important;
border-radius: 0px!important;
overflow: hidden;
background-color: white;
display: flex;
justify-content: center;
}
.post-img img{
width: 100%;
height: 100%;
object-fit: cover;
}
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = {
"shortSHA": "10ca45b8a",
"SHA": "10ca45b8a0ad7ad7f9167faa7963905a99c98bc0",
"shortSHA": "3451e74c9",
"SHA": "3451e74c90fe8c3346bf27fe75b00e30a29cf608",
"branch": "developer-prod",
"lastCommitAuthor": "'Eudes Inácio'",
"lastCommitTime": "'Wed Aug 23 13:34:03 2023 +0100'",
"lastCommitMessage": "buttons: save is first, cancel is second",
"lastCommitNumber": "5210",
"lastCommitTime": "'Thu Aug 24 18:39:31 2023 +0100'",
"lastCommitMessage": "prepare for presantation",
"lastCommitNumber": "5213",
"change": "",
"changeStatus": "On branch developer-prod\nYour branch and 'origin/developer-prod' have diverged,\nand have 6 and 3 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/modals/view-document/view-document.page.ts\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.scss\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/pages/events/events.page.scss\n\tmodified: src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts\n\tmodified: src/app/pages/gabinete-digital/event-list/event-list.page.html\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/shared/agenda/approve-event/approve-event.page.ts\n\tmodified: src/app/shared/agenda/event-list/event-list.page.html\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.scss\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts\n\tdeleted: src/app/shared/chat/new-group/group-contacts/group-contacts-routing.module.ts\n\tdeleted: src/app/shared/chat/new-group/group-contacts/group-contacts.module.ts\n\tdeleted: src/app/shared/chat/new-group/group-contacts/group-contacts.page.html\n\tdeleted: src/app/shared/chat/new-group/group-contacts/group-contacts.page.scss\n\tdeleted: src/app/shared/chat/new-group/group-contacts/group-contacts.page.spec.ts\n\tdeleted: src/app/shared/chat/new-group/group-contacts/group-contacts.page.ts\n\tmodified: src/app/shared/chat/new-group/new-group-routing.module.ts\n\tmodified: src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html\n\tmodified: src/app/shared/popover/chat-popover/chat-popover.page.html\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/store/publication-folder.service.ts",
"changeStatus": "On branch developer-prod\nYour branch and 'origin/developer-prod' have diverged,\nand have 7 and 1 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/modals/view-media/view-media.page.html\n\tmodified: src/app/modals/view-media/view-media.page.scss\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/pages/publications/view-publications/publication-detail/publication-detail.page.scss\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.scss\n\tmodified: src/app/services/functions/file.service.ts\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.scss\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.scss",
"changeAuthor": "eudes.inacio"
}