public function actionProfilePhoto() { $u = User::model()->findByPk(Yii::app()->user->id); if ($u->photo == null) { $fs = new FileSystemUtil(); $photoUrl = $fs->getStaticFile("no-photo.jpg"); if (file_exists($photoUrl)) { Response::sendImage($photoUrl); } else { die($photoUrl . " no-photo.jpg no existe"); } } else { Response::sendByteArray($u->photo); } }