1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-24 15:23:11 +02:00

Fix issue processwire/processwire-issues#335 error was thrown by InputfieldImage for too large file, even if client-side resize enabled

This commit is contained in:
Ryan Cramer
2017-08-16 10:36:17 -04:00
parent 56345aff26
commit b30c6a4ec8
2 changed files with 4 additions and 3 deletions

View File

@@ -1119,6 +1119,7 @@ function InputfieldImage($) {
var doneTimer = null; // for AjaxUploadDone event
var maxFiles = parseInt($this.find('.InputfieldImageMaxFiles').val());
var resizeSettings = getClientResizeSettings($inputfield);
var useClientResize = resizeSettings.maxWidth > 0 || resizeSettings.maxHeight > 0 || resizeSettings.maxSize > 0;
setupDropzone($this);
if(maxFiles != 1) setupDropInPlace($fileList);
@@ -1604,7 +1605,7 @@ function InputfieldImage($) {
updateProgress();
if(resizeSettings.maxWidth > 0 || resizeSettings.maxHeight > 0 || resizeSettings.maxSize > 0) {
if(useClientResize) {
var resizer = new PWImageResizer(resizeSettings);
$spinner.addClass('pw-resizing');
resizer.resize(file, function(imageData) {
@@ -1643,7 +1644,7 @@ function InputfieldImage($) {
message = extension + ' is a invalid file extension, please use one of: ' + extensions;
$errorParent.append(errorItem(message, files[i].name));
} else if(files[i].size > maxFilesize && maxFilesize > 2000000) {
} else if(!useClientResize && files[i].size > maxFilesize && maxFilesize > 2000000) {
// I do this test only if maxFilesize is at least 2M (php default).
// There might (not sure though) be some issues to get that value so don't want to overvalidate here -apeisa
var filesizeKB = toKilobyte(files[i].size),

File diff suppressed because one or more lines are too long