Jump to content


Photo

changing pics


  • Please log in to reply
4 replies to this topic

#1 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 17 August 2006 - 03:43 AM

i have this code :

<?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'])
	{
													
	}
	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\"/>");
	}
}
?>

heres the link to see it in action http://dreamshowstud...net/viewpic.php

i need the next and back buttons to scroll through the pics
is there a way to do this with the above array?

#2 litebearer

litebearer
  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 17 August 2006 - 04:09 AM

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 pertinent

http://nstoia.com/mpg/index.php

here is the link to a zip file that contains ALL of the scripts.

http://nstoia.com/mpg/mpg.zip

Lite

all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture

#3 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 17 August 2006 - 04:20 AM

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

#4 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 17 August 2006 - 04:34 AM

all my names have the same amount of letters it goes a-pic-(0-9) and b-pic-(0-9) (without the () ) and so on

is 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 ?

#5 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 17 August 2006 - 05:04 AM

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!  ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users