title: Echo byte array from php file as image src
body: <p>I have an <code>index.php</code> file which contains : </p>
  
  <pre><code>&lt;img src="photo.php" /&gt;
  </code></pre>
  
  <p>And <code>photo.php</code> :</p>
  
  <pre><code>header("Content-type: image/jpg");
  $result = base64_encode($arr['FOTO']);
  echo "data:image/jpg;base64,$result" // 1
  
  //echo "&lt;img src='data:image/jpg;base64,$result' /&gt;"; // 2
  </code></pre>
  
  <p>The code doesn't work, can someone explain why? The image is displayed when I comment the line <code>1</code> and uncomment the line <code>2</code> and request <code>photo.php</code> directly.</p>