D
D
del9937882017-02-01 18:58:51
Yii
del993788, 2017-02-01 18:58:51

How to display images with a specific name in yii2-images?

Hello. Trying to use CostaRico yii2-images . It has a "name" field in the database, in the yii2-images settings this field is empty by default, but it is there.
All images attached to the model, I display like this:

$gallery = $product->getImages();
<?php foreach ($gallery as $img): ?>
<?= Html::img($img->getUrl, ['alt' => $product->name])?>
<?php endforeach;?>

You can specify the name (name) in the model
$model->attachImage('../../image2.png', true, myname); //

Tell me, how can I select only those images that have name = myname?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question