title: image dimension validation in angular 6
body: <p>How to validate dimensions of image on upload.uploading images should be of 100 x 100 size.</p>
  
  <p><strong>Upload.ts</strong></p>
  
  <pre><code> onFileChange(event) {
       let reader = new FileReader();
       if (event.target.files &amp;&amp; event.target.files.length &gt; 0) {
         let file = event.target.files[0];
         reader.readAsDataURL(file);
         reader.onload = () =&gt; {
            this.imagePreview = reader.result;
            this.employee.photo = reader.result.split(",")[1];
       };
      }
   }  
  </code></pre>
  
  <p><strong>Upload.html</strong></p>
  
  <pre><code>    &lt;div class="row"&gt;
           &lt;div class="col-md-5"&gt;
              &lt;input type="file" id="avatar" 
              (change)="onFileChange($event)" #fileInput name="photo"&gt;
               &lt;p style="color: red"&gt;photo should be 100 x 100 size&lt;/p&gt;
            &lt;/div&gt;
       &lt;/div&gt;
  </code></pre>