我有一个脚本调用文件夹中的所有照片并列出它们,但现在脚本列出了同一行中的所有照片。图库自动生成表
我需要他们被放置在一个表,如:
<table>
<tr><td>photo 1</td><td>photo 2</td><td>photo 3</td></tr>
<tr><td>photo 4</td><td>photo 5</td><td>photo 6</td></tr>
<tr><td>photo 7</td><td>photo 8</td><td>photo 9</td></tr>
</table>
并继续这样,直到有没有更多的照片。显示照片的代码如下所示:
<?php
// loop through the array of files and print them all in a list
for($index=0; $index < $indexCount; $index++) {
$extension = substr($dirArray[$index], -3);
if ($extension == ('jpg' | 'JPG')){ // list only jpgs and JPG
echo '<li><img src=" thumbnail/' . $dirArray[$index] . '" alt="Image" /><span>' . $dirArray[$index] . '</span>';
}
}
?>
有些人可以帮我解决这个问题吗?
这里的想法是,你尝试做你想做的事情,然后如果你有问题,你问一个关于你的问题的问题。你**不**显示**完全无关的代码**,并期望我们为你**所有工作** – RiggsFolly
你能提供'我有一个脚本,调用一个文件夹中的所有照片,并列出他们。但是现在这个脚本列出了所有的照片都是原始的。如果你向我们展示你的实际问题(你有什么和你想要的),我们更有可能帮助你。 – Guildencrantz