Anuj-Panthri commited on
Commit
dc31c84
·
1 Parent(s): d5488ab

added client-side-resize to user page

Browse files
app/static/user/dashboard.js CHANGED
@@ -185,12 +185,14 @@ function filterFunction() {
185
 
186
 
187
  var database_input=document.querySelector("#database-form>.field>.add_button>input")
188
- database_input.addEventListener("change", function(e){
189
  if(e.target.files[0]){
190
  console.log(e.target.files[0].name);
 
 
191
 
192
  const formdata = new FormData();
193
- formdata.append("image",e.target.files[0]);
194
 
195
  var loader_txt=show_loading_bar();
196
  const myInterval=start_timer(loader_txt,0.2);
@@ -319,10 +321,14 @@ function update_db_crops(elem)
319
 
320
  }
321
 
322
- function face_recoginization(elem){
323
  if(elem.files[0]){
 
 
 
 
324
  formdata=new FormData();
325
- formdata.append("image",elem.files[0]);
326
 
327
  var loader_txt=show_loading_bar();
328
  const myInterval=start_timer(loader_txt,0.2);
 
185
 
186
 
187
  var database_input=document.querySelector("#database-form>.field>.add_button>input")
188
+ database_input.addEventListener("change",async function(e){
189
  if(e.target.files[0]){
190
  console.log(e.target.files[0].name);
191
+ var image_file=e.target.files[0];
192
+ image_file=await resize(image_file);
193
 
194
  const formdata = new FormData();
195
+ formdata.append("image",image_file);
196
 
197
  var loader_txt=show_loading_bar();
198
  const myInterval=start_timer(loader_txt,0.2);
 
321
 
322
  }
323
 
324
+ async function face_recoginization(elem){
325
  if(elem.files[0]){
326
+
327
+ var image_file=elem.files[0];
328
+ image_file=await resize(image_file);
329
+
330
  formdata=new FormData();
331
+ formdata.append("image",image_file);
332
 
333
  var loader_txt=show_loading_bar();
334
  const myInterval=start_timer(loader_txt,0.2);
app/templates/user/dashboard.html CHANGED
@@ -152,6 +152,7 @@
152
  <div id="save_btn_container"><button id="save_settings_btn" onclick="update_settings();">Save</button></div>
153
 
154
  </div>
 
155
  <script src="{{ url_for('static',filename='user/dashboard.js') }}"></script>
156
  {% endif %}
157
 
 
152
  <div id="save_btn_container"><button id="save_settings_btn" onclick="update_settings();">Save</button></div>
153
 
154
  </div>
155
+ <script src="{{url_for('static',filename='resize.js')}}"></script>
156
  <script src="{{ url_for('static',filename='user/dashboard.js') }}"></script>
157
  {% endif %}
158