[英]Yii2: how to pass image url as array in blueimp Gallery
<!-- Carousel -->
<?php
foreach ($todo as $key => $row) {
foreach (explode(';', rtrim($row['images'], ';')) as $key_img => $value_img) {
$items[] = ['url' => $value_img, 'src' => $value_img];
}
}
?>
<div class="products_inside_wrapper intro_wrapper">
<div class="classes_inside_item bordered_wht_border">
<?php echo dosamigos\gallery\Gallery::widget(['items' => $items]); ?>
</div>
</div>
<!-- Carousel End -->
Using 2amigos gallary widget, Im not getting images. 使用2amigos gallary小部件,我无法获取图像。 please let me know what am i doing wrong?
请让我知道我做错了什么?
I just reformatted for a my better reading (missing a ;) 我只是重新格式化以更好地阅读(缺少;)
<!-- Carousel -->
<div class="products_inside_wrapper intro_wrapper">
<div class="classes_inside_item bordered_wht_border">
<?php
foreach ($todo as $key=>$row){
foreach (explode(';',rtrim($row['images'],';')) as $key_img => $value_img) {
$items[] = ['url' => $value_img, 'src' => $value_img];
}
}
?>
</div>
<?php echo dosamigos\gallery\Gallery::widget(['items' => $items]); ?>
</div>
<!-- Carousel End -->
and be sure you have proper value in $value_img (try a var_dump) 并确保您在$ value_img中具有正确的值(尝试使用var_dump)
and i think you need also a 我想你也需要一个
src' => 'yuor_path_for_src_image'
proper value 适当的价值
In bluimp doc I have found 在bluimp doc中,我发现
<?php $items = [
[
'url' => 'http://farm8.static.flickr.com/7429/9478294690_51ae7eb6c9_b.jpg',
'src' => 'http://farm8.static.flickr.com/7429/9478294690_51ae7eb6c9_s.jpg',
'options' => array('title' => 'Camposanto monumentale (inside)')
],
where you can see value for url
and for src
the in many case these are separate path for fullimage and small image .. . 在这里,您可以看到
url
和src
的值,在许多情况下,它们是fullimage和small image的单独路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.