aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-09-08 10:10:51 +0200
committerChocobozzz <me@florianbigard.com>2021-09-08 10:16:39 +0200
commit0ea2f79d45b301fcd660efc894469a99b2239bf6 (patch)
treef100945f86cdcac37cf953b5af0c8fd1a3c8daad /client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
parent4546d92e40a253047d9648c0749578429dce1c3f (diff)
downloadPeerTube-0ea2f79d45b301fcd660efc894469a99b2239bf6.tar.gz
PeerTube-0ea2f79d45b301fcd660efc894469a99b2239bf6.tar.zst
PeerTube-0ea2f79d45b301fcd660efc894469a99b2239bf6.zip
Safer image preview
Diffstat (limited to 'client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts')
-rw-r--r--client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
index cba2c5db3..47b537b74 100644
--- a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
+++ b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
@@ -1,9 +1,10 @@
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' 2import { SafeResourceUrl } from '@angular/platform-browser'
3import { Notifier, ServerService } from '@app/core' 3import { Notifier, ServerService } from '@app/core'
4import { VideoChannel } from '@app/shared/shared-main' 4import { VideoChannel } from '@app/shared/shared-main'
5import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' 5import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
6import { getBytes } from '@root-helpers/bytes' 6import { getBytes } from '@root-helpers/bytes'
7import { imageToDataURL } from '@root-helpers/images'
7 8
8@Component({ 9@Component({
9 selector: 'my-actor-banner-edit', 10 selector: 'my-actor-banner-edit',
@@ -30,7 +31,6 @@ export class ActorBannerEditComponent implements OnInit {
30 preview: SafeResourceUrl 31 preview: SafeResourceUrl
31 32
32 constructor ( 33 constructor (
33 private sanitizer: DomSanitizer,
34 private serverService: ServerService, 34 private serverService: ServerService,
35 private notifier: Notifier 35 private notifier: Notifier
36 ) { } 36 ) { }
@@ -59,7 +59,7 @@ export class ActorBannerEditComponent implements OnInit {
59 this.bannerChange.emit(formData) 59 this.bannerChange.emit(formData)
60 60
61 if (this.previewImage) { 61 if (this.previewImage) {
62 this.preview = this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(bannerfile)) 62 imageToDataURL(bannerfile).then(result => this.preview = result)
63 } 63 }
64 } 64 }
65 65