title: Return an image from a controller action in symfony
body: <p>I need to access an image by providing its name in the url path, i tried to use this code but the image is not showing</p>
  
  <pre><code>  /**
   *
   * @Route("images/{imgname}",name="workflow_image")
   */
  public function WorkflowImageAction(Request $request,$imgname){
  
  
  
      $filepath = $this-&gt;get('kernel')-&gt;getRootDir().'/../web/images/workflow/'.$imgname;
  
      $file =    readfile($filepath);
  
      $headers = array(
          'Content-Type'     =&gt; 'image/png',
          'Content-Disposition' =&gt; 'inline; filename="'.$file.'"');
      return $file;
  }
  </code></pre>