title: yii2: how to response image and let browser show it?
body: <p>the same work can be done by follow code：</p>
  
  <pre><code>header('Content-Type:image/jpeg');
  readfile('a.jpg');
  </code></pre>
  
  <p>but now I really confused by Yii2's <code>\yii\web\Response.</code></p>
  
  <hr>
  
  <p>What I confused is like that:</p>
  
  <ol>
  <li><p>create a controller and action to provide picture</p>
  
  <p>See below</p>
  
  <pre><code>class ServerController extends \yii\web\Controller
  {
      public function actionIndex($name)
      {
          // how to response
      }
  }
  </code></pre></li>
  <li><p>access <code>http://example.com/index.php?r=server/index&amp;name=foo.jpg</code></p></li>
  </ol>
  
  <p>thanks for the answer!</p>