浏览代码

Fix #882: Correct image resize validation

Kartik Visweswaran 8 年之前
父节点
当前提交
033acd2c80
共有 2 个文件被更改,包括 8 次插入5 次删除
  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)) {

文件差异内容过多而无法显示
+ 0 - 0
js/fileinput.min.js


部分文件因为文件数量过多而无法显示