Add max file size in whiteboard

pull/1/head
yflory 5 years ago
parent 175ee492a5
commit 033b784576

@ -363,6 +363,11 @@ define([
}); });
}; };
var addImageToCanvas = function (img) { var addImageToCanvas = function (img) {
// 1 MB maximum
if (img.src && img.src.length > 1 * 1024 * 1024) {
UI.warn(Messages.upload_tooLargeBrief);
return;
}
var w = img.width; var w = img.width;
var h = img.height; var h = img.height;
if (w<h) { if (w<h) {
@ -381,6 +386,11 @@ define([
var onUpload = function (e) { var onUpload = function (e) {
var file = e.target.files[0]; var file = e.target.files[0];
var reader = new FileReader(); var reader = new FileReader();
// 1 MB maximum
if (file.size > 1 * 1024 * 1024) {
UI.warn(Messages.upload_tooLargeBrief);
return;
}
reader.onload = function () { reader.onload = function () {
var img = new Image(); var img = new Image();
img.onload = function () { img.onload = function () {

Loading…
Cancel
Save