title: Display image via php file with content type image Yii
body: <pre><code>&lt;?php
  class TestController extends CController
  {
      public function actionIndex()
      {
              $filename = "test.jpg";
              $path=Yii::getPathOfAlias('webroot.protected.images') . '/';
              $file=$path.$filename;
  
              if (file_exists($file))
              {
                  $img=getimagesize($file);
                  header('Content-Type: '.$img['mime']);
                  readfile($file);
                  exit;
              }
      }
      public function actionDisplayimg()
      {
              echo "&lt;img src='".CController::createUrl('test/')."' /&gt;";
      }
  }
  ?&gt;
  </code></pre>
  
  <p>It's not able to display the image neither on test/index or test/displayimg. Any help?</p>