Yii2 how to display image from common folder?

35 Views Asked by At

I have a problem with displaying image from common folder. Below are the code:

$pic = PicBreed::find()->where(['parent_id' => $model->id])->all();
                              
foreach ($pic as $key => $pics) {
   $display .=  Html::img('../../common/uploads/breed_pic/'.$pics->file_sys,['width'=>'150px','style'=>'padding:10px']).
        Html::button('<i class="fa fa-trash"></i>',
        [
          'disabled' => $disabled,
          'class' => 'btn btn-danger btn-sm btn-rounded btn-outline',
          'data-toggle' => 'tooltip',
          'data-placement' => 'bottom',
          'title' => 'Hapus',
          onclick' => "onDelete(". $pics->id.") ",
          ]);
        }
        echo $display;
      }

I am still new to Yii framework, so I don't understand why it does not display?

I have tried simple html image search tag, but still I could not get the image to display. In my opinion, it has something to do with the path but I don't know how to solve it.

0

There are 0 best solutions below