How to display images

Hello. I am new in Yii and php frameworks. Sorry for my English.

I use Advanced layout. I created a CRUD (for goods) in the backend and added there image field. I’ve already created the form and uploading model. Now I want to render that image in backend (for admins) and frontend (for users). How to make this image accessable from frontend and backend? I’ll be glad to see working example.


<?= Html::img('images/test.jpeg');?>

Or in model/Detailview for example:

[ 	'attribute'=>'photo', 	'value'=>$model->photo, 	'format' => ['image',['width'=>'100','height'=>'100']], ],


Gustavo Andrade, Thanks for reply. Can you show me the model and controller. I am not sure about my code(about $model->photo and uploading path)


Sure, you want to display the image where? Detailview or Gridview ?



For example:


[     'format' => 'image',     'value' => function ($model) {         return $model->getImageUrl();      }, ],


public function getImageUrl() {     return Url::to('@web/path/to/logo/' . $this->logo, true); }