title: How to compress multiple image in angular? here i attached code which can compress only 1 image at a time
body: <p>How to compress multiple image in angular? here i attached code which can compress only 1 image at a time help me to solve this.
  i dont know how to make  loop for multiple images, i did not get any documentation  for 'ngx-image-compress'</p>
  <pre><code>import {Component} from '@angular/core';
  import {NgxImageCompressService} from 'ngx-image-compress';
  
  
  @Component({
    selector: 'app-root',
    template: `
      &lt;div&gt;
        &lt;button (click)=&quot;compressFile()&quot;&gt;Upload and compress Image&lt;/button&gt;
        &lt;img *ngIf=&quot;imgResultBeforeCompress&quot; [src]=&quot;imgResultBeforeCompress&quot; alt=&quot;&quot;&gt;
        &lt;img *ngIf=&quot;imgResultAfterCompress&quot; [src]=&quot;imgResultAfterCompress&quot; alt=&quot;&quot;&gt;
      &lt;/div&gt;
    `
  })
  export class AppComponent {
  
    constructor(private imageCompress: NgxImageCompressService) {}
    
    imgResultBeforeCompress:string;
    imgResultAfterCompress:string;
  
    compressFile() {
    
      this.imageCompress.uploadFile().then(({image, orientation}) =&gt; {
      
        this.imgResultBeforeCompress = image;
        console.warn('Size in bytes was:', this.imageCompress.byteCount(image));
        
        this.imageCompress.compressFile(image, orientation, 50, 50).then(
          result =&gt; {
            this.imgResultAfterCompress = result;
            console.warn('Size in bytes is now:', this.imageCompress.byteCount(result));
          }
        );
        
      });
      
    }
  }
  </code></pre>