From 0c237b19fdf9c614293c1442f0ab95a81ce05735 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 22 Jun 2018 15:42:55 +0200 Subject: Fix images size limit --- .../app/videos/+video-edit/shared/video-image.component.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'client/src/app/videos') 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' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' import { ServerService } from '@app/core' +import { NotificationsService } from 'angular2-notifications' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-video-image', @@ -27,7 +29,9 @@ export class VideoImageComponent implements ControlValueAccessor { constructor ( private sanitizer: DomSanitizer, - private serverService: ServerService + private serverService: ServerService, + private notificationsService: NotificationsService, + private i18n: I18n ) {} get videoImageExtensions () { @@ -42,6 +46,11 @@ export class VideoImageComponent implements ControlValueAccessor { if (event.target.files && event.target.files.length) { const [ file ] = event.target.files + if (file.size > this.maxVideoImageSize) { + this.notificationsService.error(this.i18n('Error'), this.i18n('This image is too large.')) + return + } + this.file = file this.propagateChange(this.file) this.updatePreview() -- cgit v1.2.3