JP128 Posted December 23, 2006 Share Posted December 23, 2006 Ok, I have graphics in the folder /images/, and I would just like to the main commands that are used to create a slide show...I am sure some of them are like scandir, and also an array... but I would like it if someone more experienced could tell me them, thanks. Link to comment https://forums.phpfreaks.com/topic/31670-solved-slideshow/ Share on other sites More sharing options...
redarrow Posted December 23, 2006 Share Posted December 23, 2006 A slide show can not be done with php on it own you would need the page to refresh so meny times it would be madness what you need to do is use javascript or ajax to get a proper slide show in place or you could use flash.flash seems to look the best and used via ebay heres a link to help you ok.http://www.javascriptkit.com/script/script2/jsslide.shtml Link to comment https://forums.phpfreaks.com/topic/31670-solved-slideshow/#findComment-146817 Share on other sites More sharing options...
JP128 Posted December 23, 2006 Author Share Posted December 23, 2006 I am talking about using a button to go to the next picture... Link to comment https://forums.phpfreaks.com/topic/31670-solved-slideshow/#findComment-146823 Share on other sites More sharing options...
redarrow Posted December 23, 2006 Share Posted December 23, 2006 use session's then. Link to comment https://forums.phpfreaks.com/topic/31670-solved-slideshow/#findComment-146825 Share on other sites More sharing options...
JP128 Posted December 23, 2006 Author Share Posted December 23, 2006 I am not very sure what you mean by that...? Link to comment https://forums.phpfreaks.com/topic/31670-solved-slideshow/#findComment-146826 Share on other sites More sharing options...
Orio Posted December 23, 2006 Share Posted December 23, 2006 You can do something like this:[code]<?php$images_dir = "/image-dir-here/";$image_formats = array("jpg", "jpeg", "gif", "png"); //formats of pictures in the folder$files = scandir($images_dir);$i = 0;$images = array();foreach($files as $key => $filename){ if(in_array(strtolower(substr(strrchr($filename,"."),1)), $image_formats)) { $images[$i] = $filename; $i++; }}$num_pics = $i-1;if($num_pics == -1) die("No pics in folder");if(isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] <= $num_pics && $_GET['id'] >= 0) $id = $_GET['id'];else $id = 0; echo '<img src="'.$images_dir.$images[$id].'"><br>';if($id > 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.($id-1).'">previous</a>';echo ' --- ';if($id < $num_pics) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.($id+1).'">next</a>'; ?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/31670-solved-slideshow/#findComment-146830 Share on other sites More sharing options...
JP128 Posted December 23, 2006 Author Share Posted December 23, 2006 Great, Thank you... lol, I would have replied quicker but I was doing your riddle things... level 9 now.. hah Link to comment https://forums.phpfreaks.com/topic/31670-solved-slideshow/#findComment-146843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.