title: PHP - Resizing image while attaching it with online pdf (mpdf)
body: <p>I am generating a pdf with some images in it. Since the images are large in size, the size of the generated PDF will also be very large. Is there a way to dynamically reduce the size of the image while attaching it to the pdf.</p>
  
  <p>I tried something like this from <a href="https://github.com/nomisoft/White-Hat-Classes/tree/master/Simple-Image" rel="nofollow">here</a></p>
  
  <pre><code>`header('Content-Type: image/jpeg');`
  `include('SimpleImage.php');`
  `$image = new SimpleImage();`
  `$image-&gt;load($imgPath);`
  `$image-&gt;resizeToWidth(150);`
  `$image-&gt;output();`
  </code></pre>
  
  <p>note1 : $imgPath is passed from a loop and I'm using MPDF to generate the pdf.</p>