Sherry преди 1 година
родител
ревизия
2e8c09045f
променени са 2 файла, в които са добавени 21 реда и са изтрити 20 реда
  1. 5
    8
      src/fe/healthpassport/js/register.js
  2. 16
    12
      src/fe/healthpassport/lib/photoHelper.js

+ 5
- 8
src/fe/healthpassport/js/register.js Целия файл

@@ -160,6 +160,11 @@ register = function () {
160 160
 							// $('.templete_output').attr('src', templateData);
161 161
 
162 162
 							$(".photo .load-wrapp ").hide();
163
+							
164
+							setTimeout(()=>{
165
+								// console.log(finalase64Data)
166
+								sendBase64DataToApi(finalase64Data);
167
+							}, 200);
163 168
 						});
164 169
 					}
165 170
 					
@@ -169,14 +174,6 @@ register = function () {
169 174
 					$(".photo .load-wrapp ").hide();
170 175
 				}
171 176
 
172
-
173
-				if(fileInput.id == 'fileInput2') {
174
-					setTimeout(()=>{
175
-						console.log(finalase64Data)
176
-						sendBase64DataToApi(finalase64Data);
177
-					}, 200);
178
-					
179
-				}
180 177
 			});
181 178
 		});
182 179
 

+ 16
- 12
src/fe/healthpassport/lib/photoHelper.js Целия файл

@@ -8,7 +8,7 @@ var photoHelper = function () {
8 8
 
9 9
   //private menbers
10 10
   var photoData;
11
-  var maxHeight = 1200;
11
+  var maxHeight = 600;
12 12
 
13 13
   //private methods
14 14
   function init() {
@@ -16,18 +16,22 @@ var photoHelper = function () {
16 16
   }
17 17
 
18 18
   function loadFile(_input,_callback) {
19
-    // var file = document.querySelector('input[type=file]').files[0];
20
-    var file = $(_input)[0].files[0];
21
-
22
-    removePicExif(file).then(res => {
23
-      console.log(res)
24
-      file = res;
25
-      ImageHelper.resizeAndRotateImage(file,maxHeight,function(resizeImageObj){
26
-        // var newImage = new Image();
27
-        // newImage.src = resizeImageObj;
28
-        _callback(resizeImageObj);
19
+    return new Promise((reslove) => {
20
+      // var file = document.querySelector('input[type=file]').files[0];
21
+      var file = $(_input)[0].files[0];
22
+
23
+      removePicExif(file).then(res => {
24
+        console.log(res)
25
+        file = res;
26
+        ImageHelper.resizeAndRotateImage(file,maxHeight,function(resizeImageObj){
27
+          // var newImage = new Image();
28
+          // newImage.src = resizeImageObj;
29
+          _callback(resizeImageObj);
30
+          reslove(resizeImageObj)
31
+        });
29 32
       });
30
-    });
33
+    })
34
+    
31 35
   }
32 36
 
33 37
   function removePicExif(file) {