This commit is contained in:
ivan gomes
2021-11-22 15:26:04 +01:00
parent b11b2bcb31
commit 674f3636b3
9 changed files with 78 additions and 45 deletions
+9 -1
View File
@@ -30,6 +30,7 @@ import { environment } from 'src/environments/environment';
import { TimeService } from 'src/app/services/functions/time.service';
import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
import { Crop } from '@ionic-native/crop/ngx';
@Component({
@@ -119,6 +120,7 @@ export class ChatPage implements OnInit {
public ThemeService: ThemeService,
private dataService:DataService,
private router: Router,
private crop: Crop,
){
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.headers = new HttpHeaders();
@@ -549,4 +551,10 @@ hideRefreshButton(){
modal.onDidDismiss();
}
}
// this.crop.crop('path/to/image.jpg', {quality: 75})
// .then(
// newImage => console.log('new image path is: ' + newImage),
// error => console.error('Error cropping image', error)
// );
}
@@ -414,7 +414,8 @@ export class NewPublicationPage implements OnInit {
directory: Directory.Data
});
this.loadFiles();
//this.loadFiles(fileName);
this.loadFileData(fileName);
}
private async readAsBase64(photo: Photo) {
@@ -434,7 +435,7 @@ export class NewPublicationPage implements OnInit {
}
}
async loadFiles() {
async loadFiles(fileName) {
this.images = [];
const loading = await this.loadingCtrl.create({
@@ -442,11 +443,11 @@ export class NewPublicationPage implements OnInit {
});
await loading.present();
Filesystem.readdir({
path: IMAGE_DIR,
/* Filesystem.readdir({
path: `${IMAGE_DIR}/${fileName}`,
directory: Directory.Data,
}).then(result => {
console.log('ALL RESULTS', result.files[0])
console.log('ALL RESULTS', result.files)
let lastphoto = result.files[result.files.length - 1]
this.loadFileData(lastphoto);
},
@@ -461,12 +462,17 @@ export class NewPublicationPage implements OnInit {
}
).then(_ => {
loading.dismiss();
});
}); */
}
async loadFileData(fileName: string) {
console.log('ALL PHOTOT FILE', fileName)
// for (let f of fileNames) {
const loading = await this.loadingCtrl.create({
message: 'Loading data...',
});
await loading.present();
const filePath = `${IMAGE_DIR}/${fileName}`;
const readFile = await Filesystem.readFile({
@@ -483,7 +489,9 @@ export class NewPublicationPage implements OnInit {
console.log('ALL IMAGE', this.images)
this.capturedImage = this.images[0].data
//}
loading.dismiss();
}
@@ -16,6 +16,7 @@ import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-f
import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { Crop } from '@ionic-native/crop/ngx';
@Component({
selector: 'app-publications',
@@ -68,7 +69,8 @@ export class PublicationsPage implements OnInit {
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
private platform: Platform,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private crop: Crop,
) {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@@ -91,6 +93,8 @@ export class PublicationsPage implements OnInit {
}
hideRefreshButton() {
window.onresize = (event) => {
if (window.innerWidth < 801) {
@@ -452,4 +456,12 @@ export class PublicationsPage implements OnInit {
});
}
// this.crop.crop('path/to/image.jpg', {quality: 75})
// .then(
// newImage => console.log('new image path is: ' + newImage),
// error => console.error('Error cropping image', error)
// );
}