From c54d061e556b14cb0f32cfb5bd458adb5ec1eea9 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Wed, 17 Oct 2018 14:34:22 +0200 Subject: [PATCH] MOBILE-2693 data: Fix broken image after updating a picture field --- .../mod/data/fields/picture/component/picture.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/addon/mod/data/fields/picture/component/picture.ts b/src/addon/mod/data/fields/picture/component/picture.ts index dddf848d3..0c5836efa 100644 --- a/src/addon/mod/data/fields/picture/component/picture.ts +++ b/src/addon/mod/data/fields/picture/component/picture.ts @@ -124,13 +124,12 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginCo this.entryId = (value && value.recordid) || null; this.title = (value && value.content1) || ''; this.imageUrl = null; - if (this.image) { - if (this.image.offline) { - this.imageUrl = (this.image && this.image.toURL()) || null; - } else { - this.imageUrl = (this.image && this.image.fileurl) || null; + setTimeout(() => { + if (this.image) { + 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); }