diff options
Diffstat (limited to 'client/src/app/shared/shared-forms')
-rw-r--r-- | client/src/app/shared/shared-forms/preview-upload.component.ts | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/client/src/app/shared/shared-forms/preview-upload.component.ts b/client/src/app/shared/shared-forms/preview-upload.component.ts index edee6786d..a857b0a4f 100644 --- a/client/src/app/shared/shared-forms/preview-upload.component.ts +++ b/client/src/app/shared/shared-forms/preview-upload.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, forwardRef, Input, OnInit } from '@angular/core' | 1 | import { Component, forwardRef, Input, OnInit } from '@angular/core' |
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' | ||
4 | import { ServerService } from '@app/core' | 3 | import { ServerService } from '@app/core' |
4 | import { imageToDataURL } from '@root-helpers/images' | ||
5 | import { HTMLServerConfig } from '@shared/models' | 5 | import { HTMLServerConfig } from '@shared/models' |
6 | import { BytesPipe } from '../shared-main' | 6 | import { BytesPipe } from '../shared-main' |
7 | 7 | ||
@@ -23,7 +23,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { | |||
23 | @Input() previewWidth: string | 23 | @Input() previewWidth: string |
24 | @Input() previewHeight: string | 24 | @Input() previewHeight: string |
25 | 25 | ||
26 | imageSrc: SafeResourceUrl | 26 | imageSrc: string |
27 | allowedExtensionsMessage = '' | 27 | allowedExtensionsMessage = '' |
28 | maxSizeText: string | 28 | maxSizeText: string |
29 | 29 | ||
@@ -32,7 +32,6 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { | |||
32 | private file: Blob | 32 | private file: Blob |
33 | 33 | ||
34 | constructor ( | 34 | constructor ( |
35 | private sanitizer: DomSanitizer, | ||
36 | private serverService: ServerService | 35 | private serverService: ServerService |
37 | ) { | 36 | ) { |
38 | this.bytesPipe = new BytesPipe() | 37 | this.bytesPipe = new BytesPipe() |
@@ -81,8 +80,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { | |||
81 | 80 | ||
82 | private updatePreview () { | 81 | private updatePreview () { |
83 | if (this.file) { | 82 | if (this.file) { |
84 | const url = URL.createObjectURL(this.file) | 83 | imageToDataURL(this.file).then(result => this.imageSrc = result) |
85 | this.imageSrc = this.sanitizer.bypassSecurityTrustResourceUrl(url) | ||
86 | } | 84 | } |
87 | } | 85 | } |
88 | } | 86 | } |