This commit is contained in:
Eudes Inácio
2021-11-23 14:16:51 +01:00
27 changed files with 346 additions and 89 deletions
+9 -1
View File
@@ -32,6 +32,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
@Component({
selector: 'app-chat',
templateUrl: './chat.page.html',
@@ -119,6 +120,7 @@ export class ChatPage implements OnInit {
public ThemeService: ThemeService,
private dataService:DataService,
private router: Router,
){
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)
// );
}
@@ -60,7 +60,7 @@
<ion-label>{{msg.msg}}</ion-label>
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments let i = index">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" (click)="imageSize(file.image_url)">
<div>
<div>
<div class="file">
+12 -1
View File
@@ -642,11 +642,22 @@ touchStart(card) {
componentProps: {
image: msg.attachments[0].image_url,
username: msg.u.username,
_updatedAt: msg._updatedAt
_updatedAt: msg._updatedAt,
}
});
modal.present();
}
imageSize(img){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
}
@@ -29,7 +29,7 @@
<ion-item lines="none">
<ion-thumbnail slot="start">
<ion-img [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage" ></ion-img>
<ion-img [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage" (click)="imageSize(capturedImage)" ></ion-img>
<ion-row>
<ion-col>
<img src="" #imageElement/>
@@ -116,6 +116,15 @@ export class NewPublicationPage implements OnInit {
}
imageSize(image){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
ctx.drawImage(image, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
@@ -129,7 +138,7 @@ export class NewPublicationPage implements OnInit {
async laodPicture() {
const capturedImage = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Photos,
source: CameraSource.Camera,
quality: 90,
width: 1080,
height: 720,
@@ -379,13 +388,12 @@ export class NewPublicationPage implements OnInit {
async selectImage() {
const image = await Camera.getPhoto({
quality: 50,
allowEditing: false,
resultType: CameraResultType.Uri,
source: CameraSource.Photos // Camera, Photos or Prompt!
source: CameraSource.Camera // Camera, Photos or Prompt!
});
if (image) {
@@ -393,6 +401,8 @@ export class NewPublicationPage implements OnInit {
}
}
// Create a new file from a capture image
async saveImage(photo: Photo) {
const base64Data = await this.readAsBase64(photo);
@@ -483,4 +493,9 @@ export class NewPublicationPage implements OnInit {
loading.dismiss();
}
}
@@ -17,6 +17,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
@Component({
selector: 'app-publications',
templateUrl: './publications.page.html',
@@ -68,7 +69,8 @@ export class PublicationsPage implements OnInit {
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
private platform: Platform,
public ThemeService: ThemeService
public ThemeService: ThemeService,
) {
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)
// );
}