Jump to content

Archived

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

BillyBoB

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

Recommended Posts

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

Share this post


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

Share this post


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

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

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

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.