speaker219 Posted July 20, 2007 Share Posted July 20, 2007 How would i make a script that would get all of the pictures in a folder, and display one, but include a "Next Picture >>" and "Previous Picture <<" link. so when you first open the script you get 1 picture, and a link to go to the next/previous one. i wrote a script that gets all of the images in a folder and displays them, but i don't want it to show all of them at once. <?php $ignore = array('.','..','index.php'); $handle = opendir('.'); while ($file = readdir($handle)) { if (!in_array($file, $ignore)) { echo '<img src="'.$file.'"><br><hr>'; } } closedir($handle); ?> Any help would be appreciated Quote Link to comment Share on other sites More sharing options...
speaker219 Posted July 20, 2007 Author Share Posted July 20, 2007 Also, i know there are other premade scripts out there, but i would like to make my own that is nice and simple Quote Link to comment Share on other sites More sharing options...
speaker219 Posted July 20, 2007 Author Share Posted July 20, 2007 Bump Quote Link to comment Share on other sites More sharing options...
jorgep Posted July 20, 2007 Share Posted July 20, 2007 Are you still wating for this script? I can give you a hand, let me know Quote Link to comment Share on other sites More sharing options...
speaker219 Posted July 21, 2007 Author Share Posted July 21, 2007 Yup, i'm still waiting. Quote Link to comment Share on other sites More sharing options...
speaker219 Posted July 21, 2007 Author Share Posted July 21, 2007 Bump Quote Link to comment Share on other sites More sharing options...
marcus Posted July 21, 2007 Share Posted July 21, 2007 $path = "/home/path/to/your/folder"; $handle = @opendir($path) or die("Unable to open $path"); echo "<table border=0 cellspacing=3 cellpadding=3>\n"; $x=1; echo "<tr>\n"; while($file = readdir($handle)){ echo "<td><img src=\"$file\"></td>\n"; if($x == 5){ echo "</tr><tr>\n"; $x=0; } $x++; } echo "</tr>\n"; echo "</table>\n"; closedir($handle); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.