html - PHP image gallery from given folders -
i using following code output folders inside directory:
$path = 'uploads/eventos/'; $results = scandir($path); foreach ($results $result) { if ($result === '.' or $result === '..') continue; if (is_dir($path . '/' . $result)) { echo $result."<br />"; } }
then use files (images), inside each of directories found:
$dirname = "uploads/eventos/directory1/"; $images = glob($dirname.'*.{jpg,jpeg,png,jpg,jpeg,png}', glob_brace);
this works. idea being able generate similar image gallery. first list of "links" folders, when click, open in same page showing images inside.
please, point me information? need simple solution, learning, not complex image gallery. :)
thank you!!
---- edit ---- clear explanation!
i have folder structure (for example):
folder1/ image1.jpg image2.jpg ... folder2/ image1.jpg image2.jpg image3.jpg ...
i'd able output:
list:
<a href="folder1">folder1</a> <a href="folder2">folder2</a>
and able click links open in same page, gallery such (for example):
<table> <tr> <td><img src="image1.jpg" /></td> <td><img src="image1.jpg" /></td> </tr> </table>
i think clearer now! :)
this series , understand :)
code grabing files/directories excluding "." , ".." thn in foreach loop can ecoo
echo "<a href="'.$somepath.'/'.$file">$file</a>";
then on other page or same page $_get forder naem , opendir folder scan non directories , deal pics :)
Comments
Post a Comment