Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

photo album problem

Status
Not open for further replies.

stillhanginon

Programmer
Mar 25, 2005
27
US
Hi, I'm using a photo album on my website:
The code is by Tubatomic Studio
It works great except that you have to click on the "next" button twice to move to the next image. I think that the problem is that when the first image loads the "next" image is the same number, after you get the image to change it works fine. Try it here:
Here is the code:
<?php
//////// Revolver - code.php Version 1.2 ( )
//////// By Tubatomic Studio, llc ( )
////////////////////////
$Files = array(); $Files[] = "";
$dirfiles = opendir($dir); $cdate = date("Ymd"); $pg = $_GET['pg'];
if($highest_lowest == true) {$imgcount = 1; } else {$imgcount = 0;}
if (! $dirfiles)die('Can Not Find Any Images' . $dir);
while ($Filename = readdir($dirfiles))
{
if($datedriven == true) {$fulldate = substr($Filename, 0, 8); }else{$fulldate = 0;}
if ($Filename == '.' || $Filename == '..' || $Filename == '.DS_Store')continue;
if ($datedriven == true AND $fulldate > $cdate)continue;
if ($datedriven == true AND strlen($Filename) > 23 || $datedriven == true AND strlen($Filename) < 15)continue;
$imgcount++;
$Files[] = $Filename;
}
if($highest_lowest == true){
sort($Files); $imgcount = $imgcount-1;
$nextpage = $pg -1;if($nextpage < 1){ $nextpage = $imgcount; }
$prevpage = $pg +1;if($prevpage > $imgcount){ $prevpage = 1; }
}else{
sort($Files); $imgcount = $imgcount;
$nextpage = $pg +1;if($nextpage > $imgcount){ $nextpage = 1; }
$prevpage = $pg -1;if($prevpage < 1){ $prevpage = $imgcount; }
}
if($pg == "" or $pg > $imgcount or $pg < 1) $pg = $imgcount;
$imagesource = $dir . $Files[$pg];
$imageinfo = getimagesize($imagesource);
$imageheight = $imageinfo[1];
$imagewidth = $imageinfo[0];
if($datedriven == true)
{
$month = substr($Files[$pg], 4, 2);
$day = substr($Files[$pg], 6, 2);
$year = substr($Files[$pg], 0, 4);
if(strlen($Files[$pg]) == 22)
{$imagecolor = "#" . substr($Files[$pg], 12,6);} else {$imagecolor = $defaultbackcolor;}
}else{
$month = ""; $day = ""; $year = "";
if(strlen($Files[$pg]) == 22 && $getbackgroundcolorfromfilename == true)
{$imagecolor = "#" . substr($Files[$pg], 12,6);} else {$imagecolor = $defaultbackcolor;}
}
?>

I have the $datedriven set to true and $highest_lowest == true
Can anyone tell me what the problem is?
Thanks,
Jim
 
As you are specifying it to go from highest to lowest,
when you press the next button the first time in reality it is moving to the last image, image 15 in your case, press it again and it moves to image 14 etc... However image 15 seems to be the same one as image 1. So you get the same image, after that it works o.k because the rest of the images are different.

I would suggest you contact the developer and tell them about it. Otherwise check your images to make sure you don't have the same image repeated twice.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I don't have the image repeated twice.
I also noticed that if I set highest to lowest to false
then it starts with the highest number and "next" is 1, so one click works.
Then the problem is "previous".
Here I set $highest_lowest == false

The "previous" button has to be clicked twice.
??????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top