Sfoglia il codice sorgente

Update to release v4.2.7

Kartik Visweswaran 9 anni fa
parent
commit
472eda94c7

+ 17 - 0
CHANGE.md

@@ -1,6 +1,23 @@
 Change Log: `bootstrap-fileinput`
 =================================
 
+## version 4.2.7
+
+**Date**: 04-Sep-2015
+
+1. (bug #420): Revamp file status progress and positioning updates for asynchronous upload.
+2. (enh #427): Add image resizing capability before upload.
+3. (enh #428): Enhancements to asynchronous uploads when `showPreview` is `false`.
+4. (bug #429): Fix for MS Edge bug that does not support drag and drop.
+5. (enh #431): Add Danish locale translations.
+6. (enh #432): Send slugged file names with the file blob when uploading via ajax.
+7. (enh #433): Added new events for image handling.
+    - `fileimageloaded` (fires after each image is loaded in preview) - this is an existing event
+    - `fileimagesloaded` (fires after all images are loaded in preview)
+    - `fileimageresized` (fires after each image in preview is resized)
+    - `fileimagesresized` (fires after all images in preview are resized)
+    - `fileimageresizeerror` (fires when any image resize error is faced)
+
 ## version 4.2.6
 
 **Date**: 26-Aug-2015

+ 108 - 10
README.md

@@ -12,7 +12,7 @@ An enhanced HTML 5 file input for Bootstrap 3.x with file preview for various fi
 
 This plugin was initially inspired by [this blog article](http://www.abeautifulsite.net/blog/2013/08/whipping-file-inputs-into-shape-with-bootstrap-3/) and [Jasny's File Input plugin](http://jasny.github.io/bootstrap/javascript/#fileinput). But the plugin has now matured with various additional features and enhancements to be a complete (yet simple) file management tool and solution for web developers. 
 
-> NOTE: The latest version of the plugin is v4.2.6 (in dev-master). 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.2.7 (dev-master). Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-fileinput/blob/master/CHANGE.md) for details. 
 
 ## Features  
 
@@ -75,6 +75,7 @@ built upon HTML5 FormData and XMLHttpRequest Level 2 standards. Most modern brow
 11. Build up initial preview content (e.g. gallery of saved images). You can set initial preview actions (prebuilt support for initial preview delete). Other custom action buttons can be set for initial preview thumbnails as well. 
 12. Ensure plugin is still lean in size and optimized for performance inspite of the above features by optimally utilizing HTML5 & jquery features only.
 13. Automatically refresh preview with content from server as soon as an ajax upload finishes.
+14. Ability to resize images has been added since release v4.2.7. The browser must support HTML5 canvas for resizing images. In addition, this release includes various enhancements for upload management without a preview.
 
 > NOTE: Drag and Drop zone functionality, selectively appending or deleting files, and upload indicator with progress are ONLY AVAILABLE if you use AJAX BASED uploads (by setting `uploadUrl`).
 
@@ -116,13 +117,16 @@ You can also manually install the plugin easily to your project. Just download t
 Step 1: Load the following assets in your header. 
 
 ```html
-<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
+<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
 <link href="path/to/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
 <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
+<!-- canvas-to-blob.min.js is only needed if you wish to resize images before upload.
+     This must be loaded before fileinput.min.js -->
+<script src="path/to/js/plugins/canvas-to-blob.min.js" type="text/javascript"></script>
 <script src="path/to/js/fileinput.min.js"></script>
 <!-- bootstrap.js below is only needed if you wish to the feature of viewing details
      of text file preview via modal dialog -->
-<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" type="text/javascript"></script>
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" type="text/javascript"></script>
 <!-- optionally if you need translation for your language then include 
     locale file as mentioned below -->
 <script src="path/to/js/fileinput_locale_<lang>.js"></script>
@@ -130,6 +134,8 @@ Step 1: Load the following assets in your header.
 
 If you noticed, you need to load the `jquery.min.js` and `bootstrap.min.css` in addition to the `fileinput.min.css` and `fileinput.min.js`. The locale file `fileinput_locale_<lang>.js` can be optionally included for translating for your language if needed.
 
+NOTE: The `canvas-to-blob.min.js` file is the source for the [JavaScript-Canvas-to-Blob plugin by blueimp](https://github.com/blueimp/JavaScript-Canvas-to-Blob). It is required to be loaded before `fileinput.js` if you wish to use the image resize feature of the **bootstrap-fileinput** plugin. For ease of access, the plugin source for JavaScript-Canvas-to-Blob is included in the `js/plugins` folder of this project repository.
+
 Step 2: Initialize the plugin on your page. For example,
 
 ```js
@@ -860,18 +866,46 @@ function (previewId, index) {
 }
 ```
 
-### maxImageWidth
-_int_ the maximum allowed image width in `px` if you are uploading image files. Defaults to `null` which means no limit on image width.
-
-### maxImageHeight
-_int_ the maximum allowed image height in `px` if you are uploading image files. Defaults to `null` which means no limit on image height.
-
 ### minImageWidth
 _int_ the minimum allowed image width in `px` if you are uploading image files. Defaults to `null` which means no limit on image width.
 
 ### minImageHeight
 _int_ the minimum allowed image height in `px` if you are uploading image files. Defaults to `null` which means no limit on image height.
 
+### maxImageWidth
+_int_ the maximum allowed image width in `px` if you are uploading image files. Defaults to `null` which means no limit on image width. Note that if you set `resizeImage` property to `true`, then the entire image will be resized within this width.
+
+### maxImageHeight
+_int_ the maximum allowed image height in `px` if you are uploading image files. Defaults to `null` which means no limit on image height. Note that if you set `resizeImage` property to `true`, then the entire image will be resized within this height.
+
+### resizeImage
+_bool_ whether to add ability to resize uploaded images. Defaults to `false`. Note that resizing images requires HTML5 canvas support which is supported on most modern browsers. In addition, you must include the [JavaScript-Canvas-to-Blob plugin by blueimp](https://github.com/blueimp/JavaScript-Canvas-to-Blob) by including `canvas-to-blob.js` in your application. This JS file must be loaded before `fileinput.js` on the page. The JavaScript-Canvas-to-Blob source files are available in `js/plugins` folder of bootstrap-fileinput project page. The `canvas-to-blob.js` plugin is a polyfill for `canvas.toBlob` method and is needed for allowing the resized image files via HTML5 canvas to be returned as a blob. 
+
+### resizePreference
+_string_ preference to resize the image based on `width` or `height`. Defaults to `width`. This property is parsed only when `resizeImage` is `true`. If set to `width`, the `maxImageWidth` property is first tested and if image size is greater than this, then the image is resized to `maxImageWidth`. The image `height` is resized and adjusted in the same ratio as `width`. In case, the image width is already less than `maxImageWidth` then the `maxImageHeight` property is used to resize and width is adjusted in same ratio. 
+
+This will behave conversely, when `resizePreference` is set to `height` - the `maxImageHeight` will be first tested against image height and then the rest of steps will be similarly parsed with preference given to `height` instead of `width` as before. For example:
+
+```php
+// Example for resizePreference = 'width'
+// - will resize image width to 200 px if image width is > 200 px
+// - will resize image height to 200 px if image width is < 200 px and
+//   image height is > 200 px
+// if none of the above image will be returned as is
+$('#file-input').fileinput({
+    resizeImage: true,
+    maxImageWidth: 200,
+    maxImageHeight: 200,
+    resizePreference: 'width'
+});
+```
+
+### resizeQuality
+_float_ the quality of the resized image. This must be a decimal number between `0.00` to `1.00`. Defaults to `0.92`.
+
+### resizeDefaultImageType
+_string_ the default image mime type of the converted image after resize. Defaults to `image/jpeg`.
+
 ### maxFileSize
 _float_ the maximum file size for upload in KB.  If set to `0`, it means size allowed is unlimited. Defaults to `0`.
 
@@ -1090,6 +1124,23 @@ where:
 - `{name}`: will be replaced by the file name being uploaded
 - `{size}`: will be replaced by the `maxImageHeight` setting.
 
+### msgImageResizeError
+_string_ the error message to be displayed when a resize validation error occurs due to invalid image dimensions. Defaults to:
+
+```
+Could not get the image dimensions to resize.
+```
+
+### msgImageResizeException
+_string_ the exception message to be displayed when any javascript exception is thrown during resizing of the image. Defaults to:
+
+```
+Error while resizing the image.<pre>{errors}</pre>.
+```
+where:
+
+- `{errors}`: will be replaced with the exception error message.
+
 ### progressClass
 _string_ the upload progress bar CSS class to be applied when AJAX upload is in process (applicable only for ajax uploads). Defaults to `progress-bar progress-bar-success progress-bar-striped active`. 
 
@@ -1270,6 +1321,40 @@ $('#input-id').on('fileimageloaded', function(event, previewId) {
     console.log("fileimageloaded");
 });
 ```
+
+#### fileimagesloaded
+This event is triggered when all file images are fully loaded in the preview window. This is only applicable for image file previews and if `showPreview` is set to true. 
+
+**Example:**
+```js
+$('#input-id').on('fileimagesloaded', function(event) {
+    console.log("fileimagesloaded");
+});
+```
+
+#### fileimageresized
+This event is triggered when a file image in preview window is resized based on the `resizeImage` and `maxImageWidth`/`maxImageHeight` settings. This is only applicable for image file previews and if `showPreview` is set to true. Additional parameters available are: 
+
+- `previewId`: the identifier for the preview file container
+- `index`: the zero-based sequential index of the loaded file in the preview list
+
+**Example:**
+```js
+$('#input-id').on('fileimageresized', function(event, previewId, index) {
+    console.log("fileimageresized");
+});
+```
+
+#### fileimagesresized
+This event is triggered when all file images in preview window are resized based on the `resizeImage` and `maxImageWidth`/`maxImageHeight` settings. This is only applicable for image file previews and if `showPreview` is set to true. 
+
+**Example:**
+```js
+$('#input-id').on('fileimagesresized', function(event) {
+    console.log("fileimagesresized");
+});
+```
+
 #### filebrowse
 This event is triggered when the file browse button is clicked to open the file selection dialog.
 
@@ -1552,6 +1637,19 @@ $('#input-id').on('fileerror', function(event, data) {
 });
 ```
 
+#### fileimageresizeerror
+This event is triggered when an error or exception is received while resizing images (see `resizeImage` property). Additional parameters available are: 
+
+- `data`: This is a data object (associative array) that sends the following information, whose keys are:
+    - `id`: the preview thumbnail identifier (or undefined if not available)
+    - `index`: the file index/preview thumbnail index (or undefined if not available).
+
+```js
+$('#input-id').on('fileimageresizeerror', function(event, data) {
+    console.log('Image resize error');
+});
+```
+
 #### fileuploaderror
 This event is triggered when an upload or file input validation error is encountered primarily for ajax uploads (through the upload icon for each thumbnail or for every file uploaded when uploadAsync is `true`). Additional parameters available are: 
 
@@ -1566,7 +1664,7 @@ This event is triggered when an upload or file input validation error is encount
     - `jqXHR`: the `jQuery XMLHttpRequest` object used for this transaction (if available).
 
 ```js
-$('#input-id').on('fileuploaderror', function(event, data, previewId, index) {
+$('#input-id').on('fileuploaderror', function(event, data) {
     var form = data.form, files = data.files, extra = data.extra, 
         response = data.response, reader = data.reader;
     console.log('File upload error');

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
     "name": "bootstrap-fileinput",
-    "version": "4.2.6",
+    "version": "4.2.7",
     "homepage": "https://github.com/kartik-v/bootstrap-fileinput",
     "authors": [
         "Kartik Visweswaran <[email protected]>"

+ 9 - 9
css/fileinput.css

@@ -1,7 +1,7 @@
 /*!
  * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
  * @package bootstrap-fileinput
- * @version 4.2.6
+ * @version 4.2.7
  *
  * File input styling for Bootstrap 3.0
  * Built for Yii Framework 2.0
@@ -127,12 +127,7 @@
     opacity: 0.8;
 }
 
-.file-preview-frame:not(.file-preview-error) .file-preview-other:hover {
-    opacity: 1;
-}
-
-.file-actions,
-.file-other-error {
+.file-actions, .file-other-error {
     text-align: left;
 }
 
@@ -191,6 +186,11 @@
     margin: 5px auto 10px auto;
 }
 
+.file-preview-error {
+    opacity: 0.65;
+    box-shadow: none;
+}
+
 .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover {
     color: #000;
 }
@@ -218,11 +218,11 @@
 
 .file-uploading {
     background: url('../img/loading-sm.gif') no-repeat center bottom 10px;
-    opacity: 0.6;
+    opacity: 0.65;
 }
 
 .file-error-message .close {
-    margin-top: 10px;
+    margin-top: 5px;
 }
 
 .file-thumb-progress .progress, .file-thumb-progress .progress-bar {

File diff suppressed because it is too large
+ 1 - 1
css/fileinput.min.css


+ 1 - 1
examples/index.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<!-- release v4.2.6, copyright 2014 - 2015 Kartik Visweswaran -->
+<!-- release v4.2.7, copyright 2014 - 2015 Kartik Visweswaran -->
 <html lang="en">
     <head>
         <meta charset="UTF-8"/>

File diff suppressed because it is too large
+ 486 - 474
js/fileinput.js


File diff suppressed because it is too large
+ 1 - 1
js/fileinput.min.js


+ 2 - 0
js/fileinput_locale_LANG.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Height of image file "{name}" must be at least {size} px.',
         msgImageWidthLarge: 'Width of image file "{name}" cannot exceed {size} px.',
         msgImageHeightLarge: 'Height of image file "{name}" cannot exceed {size} px.',
+        msgImageResizeError: 'Could not get the image dimensions to resize.',
+        msgImageResizeException: 'Error while resizing the image.<pre>{errors}</pre>',
         dropZoneTitle: 'Drag & drop files here &hellip;',
         fileActionSettings: {
             removeTitle: 'Remove file',

+ 2 - 0
js/fileinput_locale_bg.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Височината на изображението "{name}" трябва да е поне {size} px.',
         msgImageWidthLarge: 'Широчината на изображението "{name}" не може да е по-голяма от {size} px.',
         msgImageHeightLarge: 'Височината на изображението "{name}" нее може да е по-голяма от {size} px.',
+        msgImageResizeError: 'Не може да размерите на изображението, за да промените размера.',
+        msgImageResizeException: 'Грешка при промяна на размера на изображението.<pre>{errors}</pre>',
         dropZoneTitle: 'Пуснете файловете тук &hellip;',
         fileActionSettings: {
             removeTitle: 'Махни файл',

+ 2 - 0
js/fileinput_locale_cr.js

@@ -44,6 +44,8 @@
         msgImageHeightSmall: 'Visina slikovnu datoteku "{name}" moraju biti najmanje {size} px.',
         msgImageWidthLarge: 'Širina slikovnu datoteku "{name}" ne može prelaziti {size} px.',
         msgImageHeightLarge: 'Visina slikovnu datoteku "{name}" ne može prelaziti {size} px.',
+        msgImageResizeError: 'Nije mogao dobiti dimenzije slike na veličinu.',
+        msgImageResizeException: 'Greška prilikom promjene veličine slike.<pre>{errors}</pre>',
         dropZoneTitle: 'Prevucite datoteke ovde &hellip;',
         fileActionSettings: {
             removeTitle: 'Uklonite datoteku',

+ 2 - 0
js/fileinput_locale_cz.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Výška image soubor "{name}", musí být alespoň {size} px.',
         msgImageWidthLarge: 'Šířka obrazového souboru "{name}" nelze překročit {size} px.',
         msgImageHeightLarge: 'Výška obrazového souboru "{name}" nelze překročit {size} px.',
+        msgImageResizeError: 'Nelze získat rozměry obrázku změnit velikost.',
+        msgImageResizeException: 'Chyba při změně velikosti obrázku.<pre>{errors}</pre>',
         dropZoneTitle: 'Táhni a pusť soubory sem &hellip;',
         fileActionSettings: {
             removeTitle: 'Odstranit soubor',

+ 3 - 1
js/fileinput_locale_da.js

@@ -1,5 +1,5 @@
 /*!
- * FileInput <da> Translations
+ * FileInput Danish Translations
  *
  * This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or
  * any HTML markup tags in the messages must not be converted or translated.
@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'H&oslash;jden af billedet "{name}" skal v&aelig;re p&aring; mindst {size} px.',
         msgImageWidthLarge: 'Bredden af billedet "{name}" m&aring; ikke v&aelig;re over {size} px.',
         msgImageHeightLarge: 'H&oslash;jden af billedet "{name}" m&aring; ikke v&aelig;re over {size} px.',
+        msgImageResizeError: 'Kunne ikke få billedets dimensioner for at ændre størrelsen.',
+        msgImageResizeException: 'Fejl ved at ændre størrelsen på billedet.<pre>{errors}</pre>',
         dropZoneTitle: 'Drag & drop filer her &hellip;',
         fileActionSettings: {
             removeTitle: 'Fjern fil',

+ 2 - 0
js/fileinput_locale_de.js

@@ -41,6 +41,8 @@
         msgImageHeightSmall: 'Höhe der Bilddatei "{name}" muss mindestens {size} px betragen.',
         msgImageWidthLarge: 'Breite der Bilddatei "{name}" nicht überschreiten {size} px.',
         msgImageHeightLarge: 'Höhe der Bilddatei "{name}" nicht überschreiten {size} px.',
+        msgImageResizeError: 'Konnte nicht die Bildabmessungen zu ändern.',
+        msgImageResizeException: 'Fehler beim Ändern der Größe des Bildes.<pre>{errors}</pre>',
         dropZoneTitle: 'Dateien hierher ziehen &hellip;',
         fileActionSettings: {
             removeTitle: 'Datei entfernen',

+ 2 - 0
js/fileinput_locale_el.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Ύψος του αρχείου εικόνας "{name}" πρέπει να είναι τουλάχιστον {size} px.',
         msgImageWidthLarge: 'Πλάτος του αρχείου εικόνας "{name}" δεν μπορεί να υπερβαίνει το {size} px.',
         msgImageHeightLarge: 'Ύψος του αρχείου εικόνας "{name}" δεν μπορεί να υπερβαίνει το {size} px.',
+        msgImageResizeError: 'Δεν θα μπορούσε να πάρει τις διαστάσεις της εικόνας για να αλλάξετε το μέγεθος.',
+        msgImageResizeException: 'Σφάλμα κατά την αλλαγή μεγέθους της εικόνας.<pre>{errors}</pre>',
         dropZoneTitle: 'Σύρετε τα αρχεία εδώ &hellip;',
         fileActionSettings: {
             removeTitle: 'Αφαιρέστε το αρχείο',

+ 2 - 0
js/fileinput_locale_es.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'La altura de la imagen "{name}" debe ser al menos {size} px.',
         msgImageWidthLarge: 'El ancho de la imagen "{name}" no puede exceder de {size} px.',
         msgImageHeightLarge: 'La altura de la imagen "{name}" no puede exceder de {size} px.',
+        msgImageResizeError: 'No se pudo obtener las dimensiones de imagen para cambiar el tamaño.',
+        msgImageResizeException: 'Error al cambiar el tamaño de la imagen.<pre>{errors}</pre>',
         dropZoneTitle: 'Arrastre y suelte aquí los archivos &hellip;',
         fileActionSettings: {
             removeTitle: 'Eliminar archivo',

+ 2 - 0
js/fileinput_locale_fa.js

@@ -44,6 +44,8 @@
         msgImageHeightSmall: 'ارتفاع فایل تصویر "{name}" باید حداقل {size} پیکسل باشد.',
         msgImageWidthLarge: 'عرض فایل تصویر "{name}" نمیتواند از {size} پیکسل بیشتر باشد.',
         msgImageHeightLarge: 'ارتفاع فایل تصویر "{name}" نمی‌تواند از {size} پیکسل بیشتر باشد.',
+        msgImageResizeError: 'یافت نشد ابعاد تصویر را برای تغییر اندازه.',
+        msgImageResizeException: 'خطا در هنگام تغییر اندازه تصویر.<pre>{errors}</pre>',
         dropZoneTitle: 'فایل‌ها را بکشید و در اینجا رها کنید &hellip;',
         fileActionSettings: {
             removeTitle: 'حذف فایل',

+ 2 - 0
js/fileinput_locale_fr.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Hauteur de fichier image "{name}" doit être d\'au moins {size} px.',
         msgImageWidthLarge: 'Largeur de fichier image "{name}" ne peut pas dépasser {size} px.',
         msgImageHeightLarge: 'Hauteur de fichier image "{name}" ne peut pas dépasser {size} px.',
+        msgImageResizeError: "Impossible d'obtenir les dimensions de l'image à redimensionner.",
+        msgImageResizeException: "Erreur lors du redimensionnement de l'image.<pre>{errors}</pre>",
         dropZoneTitle: 'Glissez et déposez les fichiers ici&hellip;',
         fileActionSettings: {
             removeTitle: 'Supprimer le fichier',

+ 2 - 0
js/fileinput_locale_hu.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Magassága image file "{name}" legalább {size} px.',
         msgImageWidthLarge: 'Szélessége image file "{name}" nem haladhatja meg a {size} px.',
         msgImageHeightLarge: 'Magassága image file "{name}" nem haladhatja meg a {size} px.',
+        msgImageResizeError: 'Nem lehet megszerezni a kép méretei átméretezni.',
+        msgImageResizeException: 'Hiba történt a méretezés.<pre>{errors}</pre>',
         dropZoneTitle: 'Fájlok húzása ide &hellip;',
         fileActionSettings: {
             removeTitle: 'A fájl eltávolítása',

+ 2 - 0
js/fileinput_locale_it.js

@@ -45,6 +45,8 @@
         msgImageHeightSmall: 'Altezza di file immagine "{name}" deve essere di almeno {size} px.',
         msgImageWidthLarge: 'Larghezza di file immagine "{name}" non può superare {size} px.',
         msgImageHeightLarge: 'Altezza di file immagine "{name}" non può superare {size} px.',
+        msgImageResizeError: "Impossibile ottenere le dimensioni dell'immagine per ridimensionare.",
+        msgImageResizeException: "Errore durante il ridimensionamento dell'immagine.<pre>{errors}</pre>",
         dropZoneTitle: 'Trascina i file qui&hellip;',
         fileActionSettings: {
             removeTitle: 'Rimuovere il file',

+ 2 - 0
js/fileinput_locale_nl.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Hoogte van de beeld bestand "{name}" moet minstens {size} px zijn.',
         msgImageWidthLarge: 'Breedte van de image-bestand "{name}" kan niet hoger zijn dan {size} px.',
         msgImageHeightLarge: 'Hoogte van het beeld bestand "{name}" kan niet hoger zijn dan {size} px.',
+        msgImageResizeError: 'Kon niet het beeld afmetingen resize.',
+        msgImageResizeException: 'Fout bij het verkleinen van het beeld.<pre>{errors}</pre>',
         dropZoneTitle: 'Drag & drop bestanden hier &hellip;',
         fileActionSettings: {
             removeTitle: 'Verwijder bestand',

+ 2 - 0
js/fileinput_locale_pl.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Wysokość pliku obrazu "{name}" musi być co najmniej {size} px.',
         msgImageWidthLarge: 'Szerokość pliku obrazu "{name}" nie może przekraczać {size} px.',
         msgImageHeightLarge: 'Wysokość pliku obrazu "{name}" nie może przekraczać {size} px.',
+        msgImageResizeError: 'Nie udało się uzyskać wymiary obrazu, aby zmienić rozmiar.',
+        msgImageResizeException: 'Błąd podczas zmiany rozmiaru obrazu.<pre>{errors}</pre>',
         dropZoneTitle: 'Przeciągnij i upuść pliki tu &hellip;',
         fileActionSettings: {
             removeTitle: 'Usuń plik',

+ 2 - 0
js/fileinput_locale_pt-BR.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Altura do arquivo de imagem "{name}" deve ser pelo menos {size} px.',
         msgImageWidthLarge: 'Largura do arquivo de imagem "{name}" não pode exceder {size} px.',
         msgImageHeightLarge: 'Altura do arquivo de imagem "{name}" não pode exceder {size} px.',
+        msgImageResizeError: 'Could not get the image dimensions to resize.',
+        msgImageResizeException: 'Erro ao redimensionar a imagem.<pre>{errors}</pre>',
         dropZoneTitle: 'Arraste e solte os arquivos aqui&hellip;',
         fileActionSettings: {
             removeTitle: 'Remover arquivo',

+ 2 - 0
js/fileinput_locale_pt.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Altura do arquivo de imagem "{name}" deve ser pelo menos {size} px.',
         msgImageWidthLarge: 'Largura do arquivo de imagem "{name}" não pode exceder {size} px.',
         msgImageHeightLarge: 'Altura do arquivo de imagem "{name}" não pode exceder {size} px.',
+        msgImageResizeError: 'Could not get the image dimensions to resize.',
+        msgImageResizeException: 'Erro ao redimensionar a imagem.<pre>{errors}</pre>',
         dropZoneTitle: 'Arrastar e largar ficheiros aqui &hellip;',
         fileActionSettings: {
             removeTitle: 'Remover arquivo',

+ 2 - 0
js/fileinput_locale_ro.js

@@ -44,6 +44,8 @@
         msgImageHeightSmall: 'Înălțimea fișier imagine "{name}" trebuie să fie de cel puțin {size} px.',
         msgImageWidthLarge: 'Lățimea de fișier de imagine "{name}" nu poate depăși {size} px.',
         msgImageHeightLarge: 'Înălțimea fișier imagine "{name}" nu poate depăși {size} px.',
+        msgImageResizeError: 'Nu a putut obține dimensiunile imaginii pentru a redimensiona.',
+        msgImageResizeException: 'Eroare la redimensionarea imaginii.<pre>{errors}</pre>',
         dropZoneTitle: 'Trage fișierele aici &hellip;',
         fileActionSettings: {
             removeTitle: 'Scoateți fișier',

+ 2 - 0
js/fileinput_locale_ru.js

@@ -44,6 +44,8 @@
         msgImageHeightSmall: 'Высота изображения {name} должна быть не меньше {size} px.',
         msgImageWidthLarge: 'Ширина изображения "{name}" не может превышать {size} px.',
         msgImageHeightLarge: 'Высота изображения "{name}" не может превышать {size} px.',
+        msgImageResizeError: 'Не удалось получить размеры изображения, чтобы изменить размер.',
+        msgImageResizeException: 'Ошибка при изменении размера изображения.<pre>{errors}</pre>',
         dropZoneTitle: 'Перетащите файлы сюда &hellip;',
         fileActionSettings: {
             removeTitle: 'Удалить файл',

+ 2 - 0
js/fileinput_locale_sk.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Výška image súboru "{name}", musí byť minimálne {size} px.',
         msgImageWidthLarge: 'Šírka image súboru "{name}" nemôže presiahnuť {size} px.',
         msgImageHeightLarge: 'Výška súboru obrazu "{name}" nesmie presiahnuť {size} px.',
+        msgImageResizeError: 'Nemožno získať rozmery obrázku zmeniť veľkosť.',
+        msgImageResizeException: 'Chyba pri zmene veľkosti obrázka.<pre>{errors}</pre>',
         dropZoneTitle: 'Tiahni a pusť súbory tu &hellip;',
         fileActionSettings: {
             removeTitle: 'odstrániť súbor',

+ 2 - 0
js/fileinput_locale_th.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'ความสูงของภาพไฟล์ "{name}" ต้องมีอย่างน้อย {size} px.',
         msgImageWidthLarge: 'ความกว้างของภาพไฟล์ "{name}" ไม่เกิน {size} พิกเซล.',
         msgImageHeightLarge: 'ความสูงของไฟล์ภาพ "{name}" ไม่เกิน {size} พิกเซล.',
+        msgImageResizeError: 'ไม่สามารถรับขนาดภาพเพื่อปรับขนาด',
+        msgImageResizeException: 'ข้อผิดพลาดขณะปรับขนาดภาพ<pre>{errors}</pre>',
         dropZoneTitle: 'Drag & drop ไฟล์ตรงนี้ &hellip;',
         fileActionSettings: {
             removeTitle: 'ลบไฟล์',

+ 2 - 0
js/fileinput_locale_tr.js

@@ -43,6 +43,8 @@
         msgImageHeightSmall: 'Görüntü dosyası "{name}" yüksekliği en az {size} piksel olmalıdır.',
         msgImageWidthLarge: 'Görüntü dosyası "{name}" genişliği {size} px geçemez.',
         msgImageHeightLarge: 'Resim dosyası "{name}" Yükseklik {size} px geçemez.',
+        msgImageResizeError: 'Görüntü boyutlarını yeniden boyutlandırmak için alınamadı.',
+        msgImageResizeException: 'Hata resim boyutlandırma sırasında.<pre>{errors}</pre>',
         dropZoneTitle: 'Dosyaları buraya sürükleyip bırakın &hellip;',
         fileActionSettings: {
             removeTitle: 'dosyayı kaldır',

+ 2 - 0
js/fileinput_locale_uk.js

@@ -44,6 +44,8 @@
         msgImageHeightSmall: 'Висота зображення "{name}" повинна бути не менше {size} px.',
         msgImageWidthLarge: 'Ширина зображення "{name}" не може перевищувати {size} px.',
         msgImageHeightLarge: 'Висота зображення "{name}" не може перевищувати {size} px.',
+        msgImageResizeError: 'Не вдалося розміри зображення, щоб змінити розмір.',
+        msgImageResizeException: 'Помилка при зміні розміру зображення.<pre>{errors}</pre>',
         dropZoneTitle: 'Перетягніть файли сюди &hellip;',
         fileActionSettings: {
             removeTitle: 'Видалити файл',

+ 2 - 0
js/fileinput_locale_zh-TW.js

@@ -44,6 +44,8 @@
         msgImageHeightSmall: '圖檔高度"{name}"必須至少為{size}像素(px).',
         msgImageWidthLarge: '圖檔寬度"{name}"不能超過{size}像素(px).',
         msgImageHeightLarge: '圖檔高度"{name}"不能超過{size}像素(px).',
+        msgImageResizeError: '無法獲取的圖像尺寸調整。',
+        msgImageResizeException: '錯誤而調整圖像大小。<pre>{errors}</pre>',
         dropZoneTitle: '拖曳檔案至此 &hellip;',
         slugCallback: function(text) {
             return text ? text.split(/(\\|\/)/g).pop().replace(/[^\w\u4e00-\u9fa5\-.\\\/ ]+/g, '') : '';

+ 2 - 0
js/fileinput_locale_zh.js

@@ -44,6 +44,8 @@
         msgImageHeightSmall: '图像文件的"{name}"的高度必须至少为{size}像素.',
         msgImageWidthLarge: '宽度的图像文件"{name}"不能超过{size}像素.',
         msgImageHeightLarge: '图像文件"{name}"的高度不能超过{size}像素.',
+        msgImageResizeError: '无法获取的图像尺寸调整。',
+        msgImageResizeException: '错误而调整图像大小。<pre>{errors}</pre>',
         dropZoneTitle: '拖拽文件到这里 &hellip;',
         slugCallback: function(text) {
             return text ? text.split(/(\\|\/)/g).pop().replace(/[^\w\u4e00-\u9fa5\-.\\\/ ]+/g, '') : '';

+ 95 - 0
js/plugins/canvas-to-blob.js

@@ -0,0 +1,95 @@
+/*
+ * JavaScript Canvas to Blob 2.0.5
+ * https://github.com/blueimp/JavaScript-Canvas-to-Blob
+ *
+ * Copyright 2012, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ *
+ * Based on stackoverflow user Stoive's code snippet:
+ * http://stackoverflow.com/q/4998908
+ */
+
+/*jslint nomen: true, regexp: true */
+/*global window, atob, Blob, ArrayBuffer, Uint8Array, define */
+
+(function (window) {
+    'use strict';
+    var CanvasPrototype = window.HTMLCanvasElement &&
+            window.HTMLCanvasElement.prototype,
+        hasBlobConstructor = window.Blob && (function () {
+            try {
+                return Boolean(new Blob());
+            } catch (e) {
+                return false;
+            }
+        }()),
+        hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array &&
+            (function () {
+                try {
+                    return new Blob([new Uint8Array(100)]).size === 100;
+                } catch (e) {
+                    return false;
+                }
+            }()),
+        BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder ||
+            window.MozBlobBuilder || window.MSBlobBuilder,
+        dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob &&
+            window.ArrayBuffer && window.Uint8Array && function (dataURI) {
+                var byteString,
+                    arrayBuffer,
+                    intArray,
+                    i,
+                    mimeString,
+                    bb;
+                if (dataURI.split(',')[0].indexOf('base64') >= 0) {
+                    // Convert base64 to raw binary data held in a string:
+                    byteString = atob(dataURI.split(',')[1]);
+                } else {
+                    // Convert base64/URLEncoded data component to raw binary data:
+                    byteString = decodeURIComponent(dataURI.split(',')[1]);
+                }
+                // Write the bytes of the string to an ArrayBuffer:
+                arrayBuffer = new ArrayBuffer(byteString.length);
+                intArray = new Uint8Array(arrayBuffer);
+                for (i = 0; i < byteString.length; i += 1) {
+                    intArray[i] = byteString.charCodeAt(i);
+                }
+                // Separate out the mime component:
+                mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
+                // Write the ArrayBuffer (or ArrayBufferView) to a blob:
+                if (hasBlobConstructor) {
+                    return new Blob(
+                        [hasArrayBufferViewSupport ? intArray : arrayBuffer],
+                        {type: mimeString}
+                    );
+                }
+                bb = new BlobBuilder();
+                bb.append(arrayBuffer);
+                return bb.getBlob(mimeString);
+            };
+    if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {
+        if (CanvasPrototype.mozGetAsFile) {
+            CanvasPrototype.toBlob = function (callback, type, quality) {
+                if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) {
+                    callback(dataURLtoBlob(this.toDataURL(type, quality)));
+                } else {
+                    callback(this.mozGetAsFile('blob', type));
+                }
+            };
+        } else if (CanvasPrototype.toDataURL && dataURLtoBlob) {
+            CanvasPrototype.toBlob = function (callback, type, quality) {
+                callback(dataURLtoBlob(this.toDataURL(type, quality)));
+            };
+        }
+    }
+    if (typeof define === 'function' && define.amd) {
+        define(function () {
+            return dataURLtoBlob;
+        });
+    } else {
+        window.dataURLtoBlob = dataURLtoBlob;
+    }
+}(window));

+ 1 - 0
js/plugins/canvas-to-blob.min.js

@@ -0,0 +1 @@
+!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h<b.length;h+=1)g[h]=b.charCodeAt(h);return i=a.split(",")[0].split(":")[1].split(";")[0],c?new Blob([d?g:f],{type:i}):(j=new e,j.append(f),j.getBlob(i))};a.HTMLCanvasElement&&!b.toBlob&&(b.mozGetAsFile?b.toBlob=function(a,c,d){a(d&&b.toDataURL&&f?f(this.toDataURL(c,d)):this.mozGetAsFile("blob",c))}:b.toDataURL&&f&&(b.toBlob=function(a,b,c){a(f(this.toDataURL(b,c)))})),"function"==typeof define&&define.amd?define(function(){return f}):a.dataURLtoBlob=f}(window);

+ 1 - 1
nuget/Package.nuspec

@@ -3,7 +3,7 @@
   <metadata>
     <id>bootstrap-fileinput</id>
 	<title>bootstrap-fileinput</title>
-    <version>4.2.6</version>
+    <version>4.2.7</version>
     <authors>Kartik Visweswaran, Robert Kiss (nuget package)</authors>
     <owners>Kartik Visweswaran</owners>
     <licenseUrl>https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md</licenseUrl>

Some files were not shown because too many files changed in this diff