stillhanginon
Programmer
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
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