roojs-core.js
[roojs1] / roojs-debug.js
index 0ebdf96..9f05d6a 100644 (file)
@@ -68451,6 +68451,7 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         e.preventDefault();
         
         if(typeof(this.selectorEl.dom.files) == 'undefined' || !this.selectorEl.dom.files.length){
+            console.log("EMPTY RETURN");
             return;
         }
         
@@ -68493,6 +68494,30 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         this.imageEl.OriginWidth = this.imageEl.naturalWidth || this.imageEl.width;
         this.imageEl.OriginHeight = this.imageEl.naturalHeight || this.imageEl.height;
 
+        var _this = this;
+
+        var errorMsg = "";
+
+        if(this.imageEl.OriginWidth < this.minWidth) {
+            errorMsg = "Image width should be at least " + this.minWidth + "\n";
+        }
+
+        if(this.imageEl.OriginHeight < this.minHeight) {
+            errorMsg = "Image height should be at least " + this.minHeight + "\n";
+        }
+
+        if(errorMsg.length != '') {
+            Roo.Msg.show({
+                title: 'Error',
+                msg: errorMsg,
+                buttons: {ok : true},
+                fn: function(res) {
+                    _this.selectorEl.dom.value = '';
+                    _this.selectorEl.dom.click();
+                }
+            });
+        }
+
         if(this.fireEvent('loadcanvas', this, this.imageEl) != false){
         
             this.bodyEl.un('click', this.beforeSelectFile, this);
@@ -68679,9 +68704,9 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
                 !this.isDocument &&
                 (this.rotate == 0 || this.rotate == 180) && 
                 (
-                    (this.imageEl.OriginWidth / this.imageEl.OriginHeight  > this.minWidth / this.minHeight && width < this.minWidth) || 
-                    width > maxWidth || 
-                    (this.imageEl.OriginWidth / this.imageEl.OriginHeight  < this.minWidth / this.minHeight && height < this.minHeight) || 
+                    width < this.minWidth ||
+                    height < this.minHeight ||
+                    width > maxWidth ||
                     height > maxHeight
                 )
         ){