用一对多的关系yii2详细显示图像
display image in detail view with one to many reation yii2
我有两个具有一对多关系的表,
此代码将显示路径而不是图像。如何显示图片?
试试这个。
[
'attribute'=>'photo',
'value'=>$model->photo,
'format' => ['image',['width'=>'100','height'=>'100']],
],
第一种方式是设置本栏目图片格式:
[
'attribute'=>'photo',
'format' => 'image',
'value'=>'path/to/image',
],
我有两个具有一对多关系的表,
此代码将显示路径而不是图像。如何显示图片?
试试这个。
[
'attribute'=>'photo',
'value'=>$model->photo,
'format' => ['image',['width'=>'100','height'=>'100']],
],
第一种方式是设置本栏目图片格式:
[
'attribute'=>'photo',
'format' => 'image',
'value'=>'path/to/image',
],