title: Resizing a BLOB image in PHP before sending to client
body: <p>I have an image of which I am fetching from a database as a BLOB however I am sending the client the full size image of which is then resized on their side. The images can get very large so I would like to resize the image before it is sent to the client.</p>
  
  <p>I currently have the following code:</p>
  
  <pre><code>if (!empty($row['img'])) {$img = $row['img'];}
  $width = imagesx(imagecreatefromstring($img));
  $height = imagesy(imagecreatefromstring($img));
  $resizer = $width/200;
  $newHeight = floor($height/$resizer);
  $news = $news . "&lt;div class='newsItem' style='min-height:".$newHeight."px;'&gt;";
  if (isset($img)) {$news = $news . "&lt;img src='data:image/jpeg;base64,".base64_encode($img)."' width='200' height='".$newHeight."'&gt;";}
  $news = $news . "&lt;h2&gt;".$title."&lt;/h2&gt;&lt;hr class='newsHr'&gt;&lt;span&gt;".$text."&lt;/span&gt;&lt;/div&gt;";
  </code></pre>
  
  <p>What functions can I use to resize $img?</p>