X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-forms%2Fpreview-upload.component.ts;h=a857b0a4f975648dbf798905494dc8c32e837890;hb=221ee1adc916684d4881d2a9c4c01954dcde986e;hp=edee6786db722df8733972093a2b76be3c95e614;hpb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;p=github%2FChocobozzz%2FPeerTube.git 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 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' -import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' import { ServerService } from '@app/core' +import { imageToDataURL } from '@root-helpers/images' import { HTMLServerConfig } from '@shared/models' import { BytesPipe } from '../shared-main' @@ -23,7 +23,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { @Input() previewWidth: string @Input() previewHeight: string - imageSrc: SafeResourceUrl + imageSrc: string allowedExtensionsMessage = '' maxSizeText: string @@ -32,7 +32,6 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { private file: Blob constructor ( - private sanitizer: DomSanitizer, private serverService: ServerService ) { this.bytesPipe = new BytesPipe() @@ -81,8 +80,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { private updatePreview () { if (this.file) { - const url = URL.createObjectURL(this.file) - this.imageSrc = this.sanitizer.bypassSecurityTrustResourceUrl(url) + imageToDataURL(this.file).then(result => this.imageSrc = result) } } }