MOBILE-2430 data: Fix size attributes on images

main
Pau Ferrer Ocaña 2018-06-21 16:18:38 +02:00
parent 83e41ba1a1
commit 9f3b03cbde
2 changed files with 7 additions and 5 deletions

View File

@ -13,4 +13,4 @@
<span *ngIf="mode == 'list' && imageUrl" (click)="gotoEntry.emit(entryId)"><img [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" core-external-content/></span> <span *ngIf="mode == 'list' && imageUrl" (click)="gotoEntry.emit(entryId)"><img [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" core-external-content/></span>
<img *ngIf="mode == 'show' && imageUrl" [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" [width]="width" [height]="height" core-external-content/> <img *ngIf="mode == 'show' && imageUrl" [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" [attr.width]="width" [attr.height]="height" core-external-content/>

View File

@ -13,8 +13,9 @@
// limitations under the License. // limitations under the License.
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder } from '@angular/forms';
import { AddonModDataFieldPluginComponent } from '../../../classes/field-plugin-component';
import { CoreFileSessionProvider } from '@providers/file-session'; import { CoreFileSessionProvider } from '@providers/file-session';
import { CoreDomUtilsProvider } from '@providers/utils/dom';
import { AddonModDataFieldPluginComponent } from '../../../classes/field-plugin-component';
import { AddonModDataProvider } from '../../../providers/data'; import { AddonModDataProvider } from '../../../providers/data';
/** /**
@ -38,7 +39,8 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginCo
width: string; width: string;
height: string; height: string;
constructor(protected fb: FormBuilder, private fileSessionprovider: CoreFileSessionProvider) { constructor(protected fb: FormBuilder, private fileSessionprovider: CoreFileSessionProvider,
private domUtils: CoreDomUtilsProvider) {
super(fb); super(fb);
} }
@ -129,8 +131,8 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginCo
this.imageUrl = (this.image && this.image.fileurl) || null; this.imageUrl = (this.image && this.image.fileurl) || null;
} }
} }
this.width = this.field.param1 || ''; this.width = this.domUtils.formatPixelsSize(this.field.param1);
this.height = this.field.param2 || ''; this.height = this.domUtils.formatPixelsSize(this.field.param2);
} }
} }
} }