need to display all images within a folder | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

need to display all images within a folder

i have a website and need to be able to display all images within a folder using html, javascript, and jquery and i need it to be able to have my css file style it: http://vortetty.k3live.com/mainstyle.css the images will all need to use the ID "center" to position them, if i need to use php, i can but my server is a little finicky with that

17th May 2018, 12:48 AM
vortetty
vortetty - avatar
3 Answers
+ 1
you will have to use php or some other server side script. Javascript runs on the client computer and can't access the directory structure on your server. first in your css there is no #center style defined. also, when using id vs class keep in mind you can only use an id once per page. they are supposed to be unique. If you have more than one instance of something use class. <?php $handle = opendir('/path/to/folder'); while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { echo '<ing src="/path/to/folder/'.$entry.'" class="center" />'; } } ?>
17th May 2018, 1:10 AM
Adam
Adam - avatar
0
Thank you for the code, my server most likely did not receive the update for center tag.
21st May 2018, 3:44 PM
vortetty
vortetty - avatar
0
My question is how do I use classes to assign css, not good at either
21st May 2018, 3:51 PM
vortetty
vortetty - avatar