aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-22 15:42:55 +0200
committerChocobozzz <me@florianbigard.com>2018-06-22 15:42:55 +0200
commit0c237b19fdf9c614293c1442f0ab95a81ce05735 (patch)
tree81f7ae4262630da5e8041bd70e2cb856e48253a3 /client/src/app/videos
parentc4082b8b4e3684baae0172e97297c936d7419f2c (diff)
downloadPeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.tar.gz
PeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.tar.zst
PeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.zip
Fix images size limit
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-image.component.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-image.component.ts b/client/src/app/videos/+video-edit/shared/video-image.component.ts
index df6565857..25955baaa 100644
--- a/client/src/app/videos/+video-edit/shared/video-image.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-image.component.ts
@@ -2,6 +2,8 @@ import { Component, forwardRef, Input } from '@angular/core'
2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' 2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
3import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' 3import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
4import { ServerService } from '@app/core' 4import { ServerService } from '@app/core'
5import { NotificationsService } from 'angular2-notifications'
6import { I18n } from '@ngx-translate/i18n-polyfill'
5 7
6@Component({ 8@Component({
7 selector: 'my-video-image', 9 selector: 'my-video-image',
@@ -27,7 +29,9 @@ export class VideoImageComponent implements ControlValueAccessor {
27 29
28 constructor ( 30 constructor (
29 private sanitizer: DomSanitizer, 31 private sanitizer: DomSanitizer,
30 private serverService: ServerService 32 private serverService: ServerService,
33 private notificationsService: NotificationsService,
34 private i18n: I18n
31 ) {} 35 ) {}
32 36
33 get videoImageExtensions () { 37 get videoImageExtensions () {
@@ -42,6 +46,11 @@ export class VideoImageComponent implements ControlValueAccessor {
42 if (event.target.files && event.target.files.length) { 46 if (event.target.files && event.target.files.length) {
43 const [ file ] = event.target.files 47 const [ file ] = event.target.files
44 48
49 if (file.size > this.maxVideoImageSize) {
50 this.notificationsService.error(this.i18n('Error'), this.i18n('This image is too large.'))
51 return
52 }
53
45 this.file = file 54 this.file = file
46 this.propagateChange(this.file) 55 this.propagateChange(this.file)
47 this.updatePreview() 56 this.updatePreview()