MOBILE-2693 data: Fix broken image after updating a picture field

main
Albert Gasset 2018-10-17 14:34:22 +02:00
parent 2537e06a24
commit c54d061e55
1 changed files with 5 additions and 6 deletions

View File

@ -124,13 +124,12 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginCo
this.entryId = (value && value.recordid) || null;
this.title = (value && value.content1) || '';
this.imageUrl = null;
setTimeout(() => {
if (this.image) {
if (this.image.offline) {
this.imageUrl = (this.image && this.image.toURL()) || null;
} else {
this.imageUrl = (this.image && this.image.fileurl) || null;
}
this.imageUrl = this.image.offline ? this.image.toURL() : this.image.fileurl;
}
}, 1);
this.width = this.domUtils.formatPixelsSize(this.field.param1);
this.height = this.domUtils.formatPixelsSize(this.field.param2);
}