Jump to content


Photo

[Solved btw there is the source for all the noobs] image slideshow type thing


  • Please log in to reply
2 replies to this topic

#1 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 17 August 2006 - 09:48 PM

im trying to get the image name b-pic-0 and then when they press next it finds the image in the array and goes to the next one

is there a way to do so ?

please help,
BillyBoB

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 August 2006 - 12:19 AM

Sure there's at least one way to do it. They all begin with you posting a reasonable amount of useful information along with the code you have already written ... or post your request in freelancing and offer something in return for a solution.
Legend has it that reading the manual never killed anyone.
My site

#3 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 18 August 2006 - 01:28 AM

sorry for not posting all of the above i figured it out and here is the finished code incase u want to ever do it:

<?php
if($_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'])
	{
		$currentfile = current($file_list);
		while($currentfile!=$pic)
		{
			$currentfile=next($file_list);
		}
		if(current($file_list)==$pic)
		{
			$nextfile = next($file_list);
			$pic = $nextfile;
			if(!$nextfile)
			{
				$pic = end($file_list);
			}
		}
		echo("<meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/viewpic.php?pic=$pic\" />");
		
	}
	if($_POST['back'])
	{
		$currentfile = current($file_list);
		while($currentfile!=$pic)
		{
			$currentfile=next($file_list);
		}
		if(current($file_list)==$pic)
		{
			$nextfile = prev($file_list);
			$pic = $nextfile;
			if(!$nextfile)
			{
				$pic = reset($file_list);
			}
		}
		echo("<meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/viewpic.php?pic=$pic\" />");
		
	}
	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\"/>");
	}
}
?>

this code is copyrighted but you can use the basic design of it :)  ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users