title: Why is Content-Type: image/jpeg header not working?
body: <p>I'm using GD library to resize image. Why is not <code>header('Content-Type: image/jpeg');</code> working? </p>
  
  <p>It gave me an error as you can see in pic below:</p>
  
  <p><img src="https://i.stack.imgur.com/k8bCG.png" alt="Error screenshot"></p>
  
  <p>Here are my GD details:</p>
  
  <p><img src="https://i.stack.imgur.com/hEuoF.png" alt="my GD version">.</p>
  
  <pre><code>&lt;?php  
  header("Content-type: image/jpeg");
  if(isset($_GET['image'])){ 
      $image = $_GET['image'];
      list($image_width, $image_height)= getimagesize($image);
      $new_size = ($image_width+$image_height)/($image_width*($image_height/45));
      $new_width = $image_width * $new_size;
      $new_height = $image_height * $new_size;
  
      $new_image = imagecreatetruecolor($new_width, $new_height);
      $old_image = imagecreatefromjpeg($image);
  
      imagecopyresized($new_image, $old_image, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
      imagejpeg($new_image);
  }
  ?&gt;
  </code></pre>