【发布时间】:2021-08-19 11:08:14
【问题描述】:
我正在开发一个 codeigniter 网站,目前正在尝试实现这样的布局,其中我对行中的所有图像具有相同的高度但宽度不同。
我的图像存储在 MYSQL 数据库中,其中 url 路径指向它们所在的目录。我还存储了它们的高度和宽度(高度和宽度以像素为单位存储)。
这是获取 PhotoController 中内容的 sql
$data['data'] = $this->model
->select('photo_path, photo_height, photo_width')
->get()
->getResultArray();
然后在主页视图中,这是我目前所拥有的。 (使用 bootstrap 4 进行样式设置)
<div class="container">
<div class="row">
<?php foreach ($data as $row) : ?>
<div class="col-md-4 col-lg-6">
<img src="<?= base_url($row['photo_path']); ?>" class="img-lazy img-fluid">
</div>
<?php endforeach; ?>
</div>
</div>
我被困在这里下一步该做什么。
【问题讨论】:
标签: php html bootstrap-4