I have this code with images src array so i want to display all images from this array
<?php
$image = explode(',',$model->image_url);
?>
<?=
DetailView::widget([
'model' => $model,
'attributes' => [
'request_design_id',
'email',
'mobile_no',
'description',
[
'attribute'=>'photo',
'value'=> Yii::getAlias("@web") . "/" .$image[0],
'format' => ['image',['width'=>'100','height'=>'100']],
],
'created_at',
],
]) ?>
I have only print one image. but i want to display all images from $image array
You can use the multiple html img tag with the concatenation and use the format as raw.
[
'attribute'=>'photo',
'value'=> function ($model) {
$html = '';
foreach ($images as $img) {
$html .= Html::img($img, ['width' => '100px', 'height' => '100px'])
}
return $html;
},
'format' => 'raw',
],