我有一個腳本調用文件夾中的所有照片並列出它們,但現在腳本列出了同一行中的所有照片。圖庫自動生成表
我需要他們被放置在一個表,如:
<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