Skip to content

Commit

Permalink
Updates to release v4.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Oct 31, 2016
1 parent 49c0a3e commit 5edbd4d
Show file tree
Hide file tree
Showing 42 changed files with 123 additions and 27 deletions.
18 changes: 18 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Change Log: `bootstrap-fileinput`
=================================

## version 4.3.6

**Date:** 31-Oct-2016

1. (enh #696): Better default preview zoom settings.
2. (enh #764): Update Russian Translations.
3. (enh #771): Update Chinese Translations.
4. (enh #769, #785, #786, #787): Better image resized event handling.
5. (enh #779, #789): More correct thumbnail identification post rearrange.
6. (enh #782): New validation for invalid slug file name (caption):
- if slug callback returns an empty string, then an error will be thrown using `msgInvalidFileName`.
- if slug callback returns `false` then the next file will be read and current file skipped.
7. (enh #788): New validation for minimum file size:
- new property `minFileSize` which validates the minimum file size in KB for upload, else throws
a validation error using `msgSizeTooSmall`. This defaults to `0`.
- if `minFileSize` is set to `null`, then above validation is skipped and no minimum file size
check is performed.

## version 4.3.5

**Date:** 20-Sep-2016
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ An enhanced HTML 5 file input for Bootstrap 3.x with file preview for various fi

![File Input Screenshot](https://lh3.googleusercontent.com/-3FiEmc_okc4/VBw_d2LBAJI/AAAAAAAAAL8/KbVj5X9Dus0/w596-h454-no/FileInput.jpg)

> NOTE: The latest version of the plugin is v4.3.5. Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details.
> NOTE: The latest version of the plugin is v4.3.6. Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details.
## Documentation and Demo

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-fileinput",
"version": "4.3.5",
"version": "4.3.6",
"homepage": "https://github.com/kartik-v/bootstrap-fileinput",
"authors": [
"Kartik Visweswaran <[email protected]>"
Expand Down
3 changes: 2 additions & 1 deletion css/fileinput.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* bootstrap-fileinput v4.3.5
* bootstrap-fileinput v4.3.6
* http://plugins.krajee.com/file-input
*
* Author: Kartik Visweswaran
Expand Down Expand Up @@ -109,6 +109,7 @@

.file-preview-image {
vertical-align: middle;
image-orientation: from-image;
}

.file-preview-text {
Expand Down
4 changes: 2 additions & 2 deletions css/fileinput.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<!-- release v4.3.5, copyright 2014 - 2016 Kartik Visweswaran -->
<!-- release v4.3.6, copyright 2014 - 2016 Kartik Visweswaran -->
<html lang="en">
<head>
<meta charset="UTF-8"/>
Expand Down
43 changes: 30 additions & 13 deletions js/fileinput.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* bootstrap-fileinput v4.3.5
* bootstrap-fileinput v4.3.6
* http://plugins.krajee.com/file-input
*
* Author: Kartik Visweswaran
Expand Down Expand Up @@ -460,7 +460,7 @@
other: {width: "160px", height: "160px"}
};
defaultPreviewZoomSettings = {
image: {width: "100%", height: "100%"},
image: {width: "auto", height: "auto", 'max-width': "100%",'max-height': "100%"},
html: {width: "100%", height: "100%", 'min-height': "480px"},
text: {width: "100%", height: "100%", 'min-height': "480px"},
video: {width: "auto", height: "100%", 'max-width': "100%"},
Expand Down Expand Up @@ -2167,10 +2167,10 @@
self._previewDefault(file, previewId, true);
if (self.isUploadable) {
self.addToStack(undefined);
setTimeout(function () {
readFile(index + 1);
}, 100);
}
setTimeout(function () {
readFile(index + 1);
}, 100);
self._initFileActions();
if (self.removeFromPreviewOnError) {
$('#' + previewId).remove();
Expand Down Expand Up @@ -2201,22 +2201,37 @@
$status.html('');
return;
}
var node = ctr + i, previewId = previewInitId + "-" + node, isText, isImage, file = files[i],
var node = ctr + i, previewId = previewInitId + "-" + node, isText, isImage, file = files[i], fSizeKB,
caption = file.name ? self.slug(file.name) : '', fileSize = (file.size || 0) / 1000, checkFile,
fileExtExpr = '', previewData = objUrl.createObjectURL(file), fileCount = 0, j, msg, typ, chk,
fileTypes = self.allowedFileTypes, strTypes = isEmpty(fileTypes) ? '' : fileTypes.join(', '),
fileExt = self.allowedFileExtensions, strExt = isEmpty(fileExt) ? '' : fileExt.join(', ');

if (caption === false) {
readFile(i + 1);
return;
}
if (caption.length === 0) {
msg = self.msgInvalidFileName.replace('{name}', htmlEncode(file.name));
self.isError = throwError(msg, file, previewId, i);
return;
}
if (!isEmpty(fileExt)) {
fileExtExpr = new RegExp('\\.(' + fileExt.join('|') + ')$', 'i');
}
fileSize = fileSize.toFixed(2);
fSizeKB = fileSize.toFixed(2);
if (self.maxFileSize > 0 && fileSize > self.maxFileSize) {
msg = self.msgSizeTooLarge.replace('{name}', caption)
.replace('{size}', fileSize)
msg = self.msgSizeTooLarge.replace('{name}', caption).replace('{size}', fSizeKB)
.replace('{maxSize}', self.maxFileSize);
self.isError = throwError(msg, file, previewId, i);
return;
}
if (self.minFileSize !== null && fileSize <= getNum(self.minFileSize)) {
msg = self.msgSizeTooSmall.replace('{name}', caption).replace('{size}', fSizeKB)
.replace('{minSize}', self.minFileSize);
self.isError = throwError(msg, file, previewId, i);
return;
}
if (!isEmpty(fileTypes) && isArray(fileTypes)) {
for (j = 0; j < fileTypes.length; j += 1) {
typ = fileTypes[j];
Expand All @@ -2234,8 +2249,7 @@
chk = compare(caption, fileExtExpr);
fileCount += isEmpty(chk) ? 0 : chk.length;
if (fileCount === 0) {
msg = self.msgInvalidFileExtension.replace('{name}', caption).replace('{extensions}',
strExt);
msg = self.msgInvalidFileExtension.replace('{name}', caption).replace('{extensions}', strExt);
self.isError = throwError(msg, file, previewId, i);
return;
}
Expand Down Expand Up @@ -2546,15 +2560,15 @@
self._raise('fileimageresized', [pid, ind]);
counter.val++;
if (counter.val === num_imgs) {
self._raise('fileimagesresized');
self._raise('fileimagesresized', [undefined, undefined]);
}
}, type, self.resizeQuality);
return true;
}
catch (err) {
counter.val++;
if (counter.val === num_imgs) {
self._raise('fileimagesresized');
self._raise('fileimagesresized', [undefined, undefined]);
}
return false;
}
Expand Down Expand Up @@ -3224,6 +3238,7 @@
resizePreference: 'width',
resizeQuality: 0.92,
resizeDefaultImageType: 'image/jpeg',
minFileSize: 0,
maxFileSize: 0,
maxFilePreviewSize: 25600, // 25 MB
minFileCount: 0,
Expand Down Expand Up @@ -3270,6 +3285,7 @@
msgNoFilesSelected: 'No files selected',
msgCancelled: 'Cancelled',
msgZoomModalHeading: 'Detailed Preview',
msgSizeTooSmall: 'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.',
msgSizeTooLarge: 'File "{name}" (<b>{size} KB</b>) exceeds maximum allowed upload size of <b>{maxSize} KB</b>.',
msgFilesTooLess: 'You must select at least <b>{n}</b> {files} to upload.',
msgFilesTooMany: 'Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.',
Expand All @@ -3278,6 +3294,7 @@
msgFileNotReadable: 'File "{name}" is not readable.',
msgFilePreviewAborted: 'File preview aborted for "{name}".',
msgFilePreviewError: 'An error occurred while reading the file "{name}".',
msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".',
msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.',
msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.',
msgUploadAborted: 'The file upload was aborted',
Expand Down
8 changes: 4 additions & 4 deletions js/fileinput.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5edbd4d

Please sign in to comment.