title: How to compress or resize image before uploaded in ionic 4?
body: <p>I'm creating ionic 4 angular app , and image uploaded. but the uploaded image size is bigger . now i want to resize image before uploading. below my image uploading codes given.</p>
  
  <pre><code>selectImage(e: any) {
  this.selectedFile = e.target.files[0];
  
  var file = e.dataTransfer ? e.dataTransfer.files[0] : e.target.files[0];
  var pattern = /image-*/;
  var reader = new FileReader();
  
  reader.onload = (event: any) =&gt; { // called once readAsDataURL is completed
    this.url = event.target.result;
    this.popoverController.dismiss(this.url);
    console.log('url for image:', this.url);
  };
  reader.readAsDataURL(this.selectedFile);
  
  if (!file.type.match(pattern)) {
    alert('invalid format');
    return;
  }
  }
  </code></pre>