examples/dialog/uploadCropbox.js
authorleon <leon@roojs.com>
Thu, 11 Aug 2022 02:56:31 +0000 (10:56 +0800)
committerleon <leon@roojs.com>
Thu, 11 Aug 2022 02:56:31 +0000 (10:56 +0800)
examples/dialog/uploadCropbox.js

index 9535a31..f549974 100644 (file)
@@ -175,12 +175,32 @@ var test = {
                                     listeners : {
                                         click : function () {
                                             uploadCropbox.show();
-                                            document.body.onfocus = function(e) {
-                                                if(!uploadCropbox.cropbox.selectorEl.dom.files.length) {
-                                                    uploadCropbox.dialog.hide();
+                                            // document.body.onfocus = function(e) {
+                                            //     if(!uploadCropbox.cropbox.selectorEl.dom.files.length) {
+                                            //         uploadCropbox.dialog.hide();
+                                            //     }
+                                            // }
+                                            // uploadCropbox.cropbox.selectorEl.dom.click();
+
+                                            new Pman.Request({
+                                                method : 'GET',
+                                                url : 'localhost/web.MediaOutreach/press.local.php' + '/Roo/Images',
+                                                params : {
+                                                    image_id: 162642,
+                                                    _to_base64  : 1
+                                                },
+                                                success : function(r) {
+                                                    var blobBin = atob(r.data.split(',')[1]);
+                                                    var array = [];
+                                                    for(var i = 0; i < blobBin.length; i++) {
+                                                        array.push(blobBin.charCodeAt(i));
+                                                    }
+                                                    var file = new File(array, rec.data.filename, {type: rec.data.mimetype});
+                                                    
+                                                    Roo.log(file);
+                                                    uploadCropbox.cropbox.prepare(file);
                                                 }
-                                            }
-                                            uploadCropbox.cropbox.selectorEl.dom.click();
+                                            });
                                         }
                                     }
                                 }