Explorar o código

Fix #882: Correct image resize validation

Kartik Visweswaran %!s(int64=8) %!d(string=hai) anos
pai
achega
033acd2c80
Modificáronse 2 ficheiros con 8 adicións e 5 borrados
  1. 8 5
      js/fileinput.js
  2. 0 0
      js/fileinput.min.js

+ 8 - 5
js/fileinput.js

@@ -2651,14 +2651,17 @@
             }
         },
         _getResizedImage: function (config, counter, numImgs) {
-            var self = this, img = config.img, width = img.naturalWidth, height = img.naturalHeight, ratio = 1,
-                maxWidth = self.maxImageWidth || width, maxHeight = self.maxImageHeight || height,
+            var self = this, img = $(config.img)[0], width = img.naturalWidth, height = img.naturalHeight,
+                ratio = 1, maxWidth = self.maxImageWidth || width, maxHeight = self.maxImageHeight || height,
                 isValidImage = !!(width && height), chkWidth, chkHeight, canvas = self.imageCanvas,
                 context = self.imageCanvasContext, type = config.typ, pid = config.pid, ind = config.ind,
-                thumb = config.thumb, errFunc, throwError, msg;
-            errFunc = self.isUploadable ? self._showUploadError : self._showError;
+                thumb = config.thumb, throwError, msg;
             throwError = function (msg, params, ev) {
-                errFunc(msg, params, ev);
+                if (self.isUploadable) {
+                    self._showUploadError(msg, params, ev);
+                } else {
+                    self._showError(msg, params, ev);
+                }
                 self._setPreviewError(thumb, ind);
             };
             if (!self.filestack[ind] || !isValidImage || (width <= maxWidth && height <= maxHeight)) {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
js/fileinput.min.js


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio