simply put i have a directory of images on my ftp. all images are already formatted. i just need a simple script to display them on a webpage. the ONLY constraint i need is that there is a few img breaks (<br><br><br>) after each image. that's it, just a simple list of images. thanks for any help.
try the following code. $dir = "/images"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { echo '<img src ="'.$dir.$file.'"> <br><br><br>'; } closedir($dh); } } PHP:
hmm not working. i just throw this code in a php file and upload it into the same folder as my images? little confused.. thanks.
If you put this file in the same directory as your images, then change this line: $dir = "/images"; to this: $dir = "./"; haven't test it but give a try.
replace $dir = "/images"; with $dir = realpath("./")."/images"; PHP: Assuming that there's a folder called images in the same folder as the php script. However stick with relative path when writing it to the html.