Good day to all! Tell me what could be the problem?

Hooked up the costa-rico / yii2-images widget. Everything works: the photo loads, deletes, but does not display images in the view. Yii does not show errors. The html code of the images is inserted into the browser, but the browser gives a 404 error.

screen display in the browser

View code:

<?php use yii\helpers\Html; use yii\widgets\DetailView; $images = $model->getImages(); $data = ''; foreach ($images as $image) { $data .= Html::img($image->getUrl(), ['alt' => 'objphoto']); } ?> <?= DetailView::widget([ 'model' => $model, 'attributes' => [ ........ [ 'attribute' => 'images', 'format' => 'html', 'value' => $data, ], ....... ], ]) ?> 
  • Show the module configuration - Denis Ostrovsky
  • Denis, judging by the whole thing in the links. I went to the following code using scientific method, which worked $ data. = Html :: img ('/ uploads / realty /'.$ image-> filePath, [' alt '=>' objphoto ',' height '=> 200 ]); For some reason, the code from the documentation turned out to be inoperative. - Denis
  • Well, not quite like a spear)) I basically understood that CostaRico changes links, apparently encrypts the actual paths to the files. In his documentation, the getUrl (); method is responsible for this. In this case, the filePath is stored in the database with a normal link to the file. So it works. - Denis
  • Good evening. And where is the image information stored? - user216615 3:06 pm
  • Good day! infa stored in the database in the table. After installing the widget, you need to do a table migration through the composer, more precisely two migrations. The first one adds the image table itself, and the second adds the name column to the table. But for some reason I always have it empty. - Denis

0