mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix load image
This commit is contained in:
@@ -813,7 +813,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
card.el.style['z-index'] = 11;
|
||||
}
|
||||
|
||||
downloadFileMsg(msg) {
|
||||
downloadFileMsg(msg: MessageService) {
|
||||
console.log('FILE TYPE', msg.file.type)
|
||||
this.downloadFile = "";
|
||||
if (msg.file.type == "application/img") {
|
||||
@@ -826,6 +826,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
|
||||
msg.file = {
|
||||
guid: msg.file.guid,
|
||||
image_url: this.downloadFile,
|
||||
type: msg.file.type
|
||||
}
|
||||
|
||||
await this.storage.set(msg.file.guid, this.downloadFile).then(() => {
|
||||
console.log('IMAGE SAVED')
|
||||
@@ -839,7 +845,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
async openPreview(msg) {
|
||||
if (msg.file.image_url === null) {
|
||||
|
||||
if (msg.file.image_url === null || msg.file.image_url === '' ) {
|
||||
this.downloadFileMsg(msg)
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user