title: Php Stream image from private to public folder
body: <p>I have an JPG image stored in </p>
  
  <p><code>/app/storage/foobar.jpg</code></p>
  
  <p>And I wanna show this in:
  <code>/public/foobar.php</code></p>
  
  <p>The JPG isn't stored in public repository, so I have to do something different then <code>&lt;img src="/images/foobar.jpg"&gt;</code>.</p>
  
  <p>What I have:`</p>
  
  <pre><code>$path = '/app/storage/foobar.jpg'; // or something equal, lets say this returns the correct JPG
  $_mime = 'image/jpeg';
          $headers = [
              'Content-Type'              =&gt; $_mime,
              'Content-Transfer-Encoding' =&gt; 'binary',
              'Content-Disposition'       =&gt; 'inline; filename="foobar"',
              'Expires'                   =&gt; 0,
              'Cache-Control'             =&gt; 'must-revalidate, post-check=0, pre-check=0',
              'Pragma'                    =&gt; 'public',
              'Content-Length'            =&gt; filesize($path),
          ];  
  </code></pre>
  
  <p>And then? Now i have the headers</p>