Jump to content

Archived

This topic is now archived and is closed to further replies.

BillyBoB

changing pics

Recommended Posts

i have this code :

[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\"/>");
}
}
?>
[/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 pics
is there a way to do this with the above array?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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!  ;)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.