BillyBoB Posted August 17, 2006 Share Posted August 17, 2006 i have this code : [code]<?phpif($_GET['pic']){ $pic = $_GET['pic']; echo(" <a href=\"viewpic.php?pic=$pic&full=y\" border = \"0\"><img src=\"halopics/$pic.jpg\" height=\"300\" width=\"490\" border = \"0\" /></a><br /><center>Click the Pic to Enlarge.</center><br />"); echo("<center><form method=\"POST\"><input type=\"submit\" name=\"back\" value=\"Back\" />\____/<input type=\"submit\" name=\"next\" value=\"Next\" /></form></center><br />"); $dir = './halopics/'; $handle = opendir($dir); while (($file = readdir($handle)) !== false) { if ( !in_array($file, array('.', '..') ) ) { $file_list[] = basename($file, '.jpg'); } } closedir($handle); asort($file_list); if($_POST['next']) { } if($_POST['back']) { } echo (" <center><form method=\"POST\">Select:<select name=\"pic\"> "); foreach($file_list as $key => $value){ echo (" <option>$value</option> "); } echo(" </select> <input type=\"submit\" name=\"submit\" value=\"View Pic\" /> </form></center> "); if($_POST['submit']) { $pic = $_POST['pic']; echo("<meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/viewpic.php?pic=$pic\"/>"); }}else{ $dir = './halopics/'; $handle = opendir($dir); while (($file = readdir($handle)) !== false) { if ( !in_array($file, array('.', '..') ) ) { $file_list[] = basename($file, '.jpg'); } } closedir($handle); asort($file_list); echo (" <center><form method=\"POST\">Select:<select name=\"pic\"> "); foreach($file_list as $key => $value){ echo (" <option>$value</option> "); } echo(" </select> <input type=\"submit\" name=\"submit\" value=\"View Pic\" /> </form></center> "); if($_POST['submit']) { $pic = $_POST['pic']; echo("<meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/viewpic.php?pic=$pic\"/>"); }}?>[/code]heres the link to see it in action [url=http://dreamshowstudios.net/viewpic.php]http://dreamshowstudios.net/viewpic.php[/url]i need the next and back buttons to scroll through the picsis there a way to do this with the above array? Quote Link to comment Share on other sites More sharing options...
litebearer Posted August 17, 2006 Share Posted August 17, 2006 Not sure if this will help, but its an album that uses a flat file rather than a database. The pic urls & names are placed into an array (much like you are doing with readdir).You probably could adapt the pagination portions to do what you want.I disabled the add/edit/delete functions as it is the View portion that is pertinenthttp://nstoia.com/mpg/index.phphere is the link to a zip file that contains ALL of the scripts.http://nstoia.com/mpg/mpg.zipLite Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 17, 2006 Author Share Posted August 17, 2006 thats not exactly wat im looking for im looking for a script to make it where when next is hit then it takes the position of the pic and then changes the name to the next pic in the array Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 17, 2006 Author Share Posted August 17, 2006 all my names have the same amount of letters it goes a-pic-(0-9) and b-pic-(0-9) (without the () ) and so onis there a way to start reading a array from a certain point then skip this many letters then save this many and ignore the rest ? Quote Link to comment Share on other sites More sharing options...
HeyRay2 Posted August 17, 2006 Share Posted August 17, 2006 Check out this file browser:http://filenice.com/You could use it's image viewing code as an example for tracking previous, current and next pictures.Good luck! ;) 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.