Jump to content

changing pics


BillyBoB

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.