diff options
Diffstat (limited to 'client/src/app')
4 files changed, 10 insertions, 14 deletions
diff --git a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts index 2c0e45e20..8b7d64ed3 100644 --- a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts +++ b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' | ||
3 | import { Notifier, ServerService } from '@app/core' | 2 | import { Notifier, ServerService } from '@app/core' |
4 | import { Account, VideoChannel } from '@app/shared/shared-main' | 3 | import { Account, VideoChannel } from '@app/shared/shared-main' |
5 | import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' |
6 | import { getBytes } from '@root-helpers/bytes' | 5 | import { getBytes } from '@root-helpers/bytes' |
6 | import { imageToDataURL } from '@root-helpers/images' | ||
7 | 7 | ||
8 | @Component({ | 8 | @Component({ |
9 | selector: 'my-actor-avatar-edit', | 9 | selector: 'my-actor-avatar-edit', |
@@ -30,10 +30,9 @@ export class ActorAvatarEditComponent implements OnInit { | |||
30 | maxAvatarSize = 0 | 30 | maxAvatarSize = 0 |
31 | avatarExtensions = '' | 31 | avatarExtensions = '' |
32 | 32 | ||
33 | preview: SafeResourceUrl | 33 | preview: string |
34 | 34 | ||
35 | constructor ( | 35 | constructor ( |
36 | private sanitizer: DomSanitizer, | ||
37 | private serverService: ServerService, | 36 | private serverService: ServerService, |
38 | private notifier: Notifier | 37 | private notifier: Notifier |
39 | ) { } | 38 | ) { } |
@@ -63,7 +62,7 @@ export class ActorAvatarEditComponent implements OnInit { | |||
63 | this.avatarChange.emit(formData) | 62 | this.avatarChange.emit(formData) |
64 | 63 | ||
65 | if (this.previewImage) { | 64 | if (this.previewImage) { |
66 | this.preview = this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(avatarfile)) | 65 | imageToDataURL(avatarfile).then(result => this.preview = result) |
67 | } | 66 | } |
68 | } | 67 | } |
69 | 68 | ||
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 @@ | |||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' | 2 | import { SafeResourceUrl } from '@angular/platform-browser' |
3 | import { Notifier, ServerService } from '@app/core' | 3 | import { Notifier, ServerService } from '@app/core' |
4 | import { VideoChannel } from '@app/shared/shared-main' | 4 | import { VideoChannel } from '@app/shared/shared-main' |
5 | import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' | 5 | import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' |
6 | import { getBytes } from '@root-helpers/bytes' | 6 | import { getBytes } from '@root-helpers/bytes' |
7 | import { 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 | ||
diff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts index a4adfd1b7..c323dc724 100644 --- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts +++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { SafeResourceUrl } from '@angular/platform-browser' | ||
3 | import { VideoChannel } from '../shared-main' | 2 | import { VideoChannel } from '../shared-main' |
4 | import { Account } from '../shared-main/account/account.model' | 3 | import { Account } from '../shared-main/account/account.model' |
5 | 4 | ||
@@ -22,7 +21,7 @@ export class ActorAvatarComponent { | |||
22 | @Input() account: ActorInput | 21 | @Input() account: ActorInput |
23 | @Input() channel: ActorInput | 22 | @Input() channel: ActorInput |
24 | 23 | ||
25 | @Input() previewImage: SafeResourceUrl | 24 | @Input() previewImage: string |
26 | 25 | ||
27 | @Input() size: ActorAvatarSize | 26 | @Input() size: ActorAvatarSize |
28 | 27 | ||
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 | } |