Tuesday, 4 April 2017

Upload the image only after validating the image size in express js

Here is my code to check the image size and width that matches the criteria

im.identify(req.files.image,function (err,features) {      
   //console.log(features);                                
    if(features.width<1000){                               
        console.log('need bigger size');                   
    }                                                      
  });  
 //upload code here
 beginUpload();

Since its asynchronous the beginUpload() function is invoked early so how can i check the image size synchronously. ie i want to upload the image that pass the size criteria



via Jabaa

No comments:

Post a Comment