duanou9758 2019-05-13 12:13
浏览 60

在每个画廊的PHP空白

I may just overlook sth. but I wrote a really easy gallery with the php code below. I always get a blank space with no picture an no div container in the second row on the first column. All pictures load and display correctly, i got no errors or warnings. I just have a blank space.

I tried to filter empty or hidden files and I changed the number images per row. But nothing worked. What else can i look for? And i tried to var_dump $images. Everything seems right there. 17 Pictures with the correct name and path.

my css just has a float:left to display the pictures.

<?php
$dir = __DIR__ . DIRECTORY_SEPARATOR . "gallery" . DIRECTORY_SEPARATOR;
$images = glob($dir . "*.{jpg,jpeg,png}", GLOB_BRACE);
?>

<!DOCTYPE html>
<html lang="de">
  <head>
  </head>
  <body>
    <h1>Gallery</h1>
    <div class="col-lg-12" id="con">
        <?php
        foreach ($images as $i) {
          printf("<div class='col-lg-4' id='gallery'><img src='gallery/%s' class='img-thumbnail'/></div>", basename($i));
        }?>
      </div>
  </body>
</html>

I just want 3 pictures in a row with no blank space in the second row, first column

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100