diff options
Diffstat (limited to 'client/src/app/shared/images/preview-upload.component.ts')
-rw-r--r-- | client/src/app/shared/images/preview-upload.component.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/client/src/app/shared/images/preview-upload.component.ts b/client/src/app/shared/images/preview-upload.component.ts index 85a2173e9..7519734ba 100644 --- a/client/src/app/shared/images/preview-upload.component.ts +++ b/client/src/app/shared/images/preview-upload.component.ts | |||
@@ -3,6 +3,8 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | |||
3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' | 3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' |
4 | import { ServerService } from '@app/core' | 4 | import { ServerService } from '@app/core' |
5 | import { ServerConfig } from '@shared/models' | 5 | import { ServerConfig } from '@shared/models' |
6 | import { BytesPipe } from 'ngx-pipes' | ||
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | 8 | ||
7 | @Component({ | 9 | @Component({ |
8 | selector: 'my-preview-upload', | 10 | selector: 'my-preview-upload', |
@@ -24,14 +26,20 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { | |||
24 | 26 | ||
25 | imageSrc: SafeResourceUrl | 27 | imageSrc: SafeResourceUrl |
26 | allowedExtensionsMessage = '' | 28 | allowedExtensionsMessage = '' |
29 | maxSizeText: string | ||
27 | 30 | ||
28 | private serverConfig: ServerConfig | 31 | private serverConfig: ServerConfig |
32 | private bytesPipe: BytesPipe | ||
29 | private file: Blob | 33 | private file: Blob |
30 | 34 | ||
31 | constructor ( | 35 | constructor ( |
32 | private sanitizer: DomSanitizer, | 36 | private sanitizer: DomSanitizer, |
33 | private serverService: ServerService | 37 | private serverService: ServerService, |
34 | ) {} | 38 | private i18n: I18n |
39 | ) { | ||
40 | this.bytesPipe = new BytesPipe() | ||
41 | this.maxSizeText = this.i18n('max size') | ||
42 | } | ||
35 | 43 | ||
36 | get videoImageExtensions () { | 44 | get videoImageExtensions () { |
37 | return this.serverConfig.video.image.extensions | 45 | return this.serverConfig.video.image.extensions |
@@ -41,6 +49,10 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { | |||
41 | return this.serverConfig.video.image.size.max | 49 | return this.serverConfig.video.image.size.max |
42 | } | 50 | } |
43 | 51 | ||
52 | get maxVideoImageSizeInBytes () { | ||
53 | return this.bytesPipe.transform(this.maxVideoImageSize) | ||
54 | } | ||
55 | |||
44 | ngOnInit () { | 56 | ngOnInit () { |
45 | this.serverConfig = this.serverService.getTmpConfig() | 57 | this.serverConfig = this.serverService.getTmpConfig() |
46 | this.serverService.getConfig() | 58 | this.serverService.getConfig() |