ich habe mir ja eine Gallery gebastelt und dachte eigtl auch das diese Funktioniert, nun habe ich einen Fehler entdeckt der mich sehr stört.
Wenn ich blättere werden statt 20 40 oder 60 Bilder angezeigt je nachdem welche Werte übergeben werden, vielleicht habt ihr Ideen warum das so sit, hier der Code:
- Code: Alles auswählen
<?php
$pics_per_row = 5;
$pic_rows = 4;
if(isset($_GET["sub"])) {
$mainid = $_GET["sub"];
}
if(isset($_GET["g3txp4g3"])) {
$id = $_GET["g3txp4g3"];
}
$dir = "pictures/".$mainid."/".$id;
function scandir($dir,$listDirectories=false, $skipDots=true) {
$dirArray = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (($file != "." && $file != ".." && $file != "thumb") || $skipDots == false) {
if($listDirectories == false) { if(is_dir($file)) { continue; } }
array_push($dirArray,basename($file));
}
}
closedir($handle);
}
return $dirArray;
}
if(isset($_GET["page"])) {
$start = $_GET["page"];
$end = $start + 20;
$newstart = $end;
$back = $start - 20;
}
else {
$start = 0;
$end = 20;
$newstart = $end;
$back = 0;
}
$data = scandir($dir);
$total = count($data);
echo '<div style="float:left;clear:left; text-align: center;"><b>Bilder gesamt: '. $total .'</b></div>';
echo '<div style="float:right;clear:right;">';
if($start > 0) {
echo '<a href="gallery.php?sub='.$mainid.'&g3txp4g3='.$id.'&page='.$back.'"><< zurück</a> ';
}
if($total >= $end) {
echo '<a href="gallery.php?sub='.$mainid.'&g3txp4g3='.$id.'&page='.$newstart.'">weiter >></a></div>
<br>';
}
else {
echo "</div><br>";
}
$output = array_splice($data, $start, $end);
foreach($output as $pic) {
echo '<div class="pic">
<table width="100%" height="100%"><tr><td align="center" valign="middle">
<a href="'.$dir.'/'.$pic.'" target="_blanK">
<img src="'.$dir.'/thumb/'.$pic.'" border="0">
</a>
</td></tr></table>
</div>
';
}
?>