title: Show image from MSSQL via php
body: <p>I need to show images that stored at MSSQL DB;</p>
  
  <p>First i am getting image;</p>
  
  <pre><code>$query=sqlsrv_query($conn,"SELECT Picture FROM dbo.PList WHERE ID='$_GET[id]' AND Section='$_SESSION[divID]'");
  $photo=sqlsrv_fetch_array($query,SQLSRV_FETCH_ASSOC);
  $photo=$photo["Picture"];
  </code></pre>
  
  <p>Then, if i use this code, it works:</p>
  
  <pre><code>$mime = "image/jpeg";
  $b64Src = "data:".$mime.";base64," . base64_encode($photo);         
  echo '&lt;img src="'.$b64Src.'" alt="" /&gt;';
  </code></pre>
  
  <p>But, i when i am trying to use this:</p>
  
  <pre><code>header("Content-Type: image/jpeg");
  print($photo);
  </code></pre>
  
  <p>Browser says, that there is an error.
  How to show image, what i am doing wrong?</p>