How to put an image in GridView in yii2?I have the following code. But its not displaying the image as it is not giving any image url. Where to put the image url?
It is simple you can just declare it in your index file as below.
[
'label' => Your Label Here',
'format' => 'raw',
'value' => function ($data) {
$images = '';
$images = $images.Html::img(\Yii::$app->request->BaseUrl.'/your-path-here/'.$date->getImagefilename(),['alt'=>'','width'=>'30','height'=>'30', 'data-toggle'=>'tooltip','data-placement'=>'left','title' => $name->pictogram_comment ,'style'=>'cursor:default;']);
return ($images);
}
],
You will have to get image instance from your model. If required example please comment, will get back on that.