Z
Z
ZaurK2016-10-05 13:50:57
Yii
ZaurK, 2016-10-05 13:50:57

How to display image in yii2?

I'm trying to display a picture from the database in a view, the path to the folder with the picture is backend/web/images. Here is the code in the view: It seems that the path is displayed in the browser, but for some reason the link is broken. I tried to put a slash in front. Please tell me what is wrong here?
<?= Html::img(@backend.'/web/' .$model->image) ?>
<img src="backend/web/images/13363.jpg" alt="">

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sinitsyn, 2016-10-05
@ZaurK

Can do<img src="/images/13363.jpg" alt="">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question