0
在我的yii2项目中,我想获取我的图像复选框以便按图像搜索。每当用户选中复选框并提交按钮时,它应该只显示那些检查图像的内容。Yii2图像将在搜索表单中有复选框列表
我的复选框列表
<?php $img = ArrayHelper::map(app\models\GhsPictogram::find()->all(), 'pictogram_id', 'pictogram_filepath') ?>
<?= $form->field($model, 'ghsPictogram',['template'=>'<div class="ghs-pict"> {label}{input} </div>'])->checkboxList($model->imageList($img)) ?>
我的图像列表的方法在我的模型
public function imageList($filenames) {
$imageList = [];
foreach ($filenames as $key => $value) {
$imageList[$key] = Html::img(
Yii::$app->request->baseUrl . 'web' . $value,
'', array("style"=>"width: 50px")
);
}//foreach $filenames
return $imageList;
}
,但在我的形式,它不显示图像。它反而显示图像src。
帮我找到我怎么能在搜索表单域显示图像。谢谢