Hoi,
Het script hieronder is een gedeelte van een fotoboek. Hier wordt een foto geshowd, met daaronder een slideshow van tumbnails.
Het probleem zit m in het stukje code waarin ik de 'vorige' thumbnails wil laten zien. Eigenlijk gaat dat best goed, ik doe precies zoals het moet één minder, zodat inderdaad de vorige foto, als die bestaat, weergegeven wordt.
Alleen is nu de volgorde, met als zichtbare foto nummer 0:
-1 -2 -3 0 1 2 3 en dit moet worden: -3 -2 -1 0 1 2 3. Ik moest eigenlijk de volgorde waarin ik de html kolommen maak, kunnen omdraaien.
Ter verduidelijking: zie code: regel nr. 30-39
<?php
function show_img ( $directory, $ext, $thumb, $slide ) {
// Array van alle images
$images = get_img ( $directory, $ext, $thumb );
$slide = 5;
$thumb_size = max ( getimagesize ( $directory."/".$thumb."/".$_GET['View'] ) ) ;
// Tabel maken
$html = "\n<!-- Start of Automatic Filled Table -->\n<center>\n<table>\n";
// 1 Foto met Thumb-Slide-Show creeren
if ( isset ( $_GET['View'] ) && file_exists ( $directory."/".$_GET['View'] ) ) {
// Grote foto laten zien in tabel, 1e rij, 1e kolom
$count = array_keys ( $images , $_GET['View'] );
$html .= "<tr><center><div>";
if ( array_key_exists ( $count[0], $images ) ) {
$html .= "<img height=\"200\" width=\"200\" src=\"".$directory."/".$images[$count[0]]."\" title=\"".$directory."/".$images[$count[0]]."\"/>";
} else {
$html .= " ";
}
$html .= "</div></center></tr><tr>";
// 1 BACK
for ( $i=0; $i < ($slide-1)/2; $i++ ) {
$html .="<td height=\"".$thumb_size."\" width=\"".$thumb_size."\">";
$count[0]--;
if ( array_key_exists ( ( $count[0] ), $images ) ) {
$html .= "<a href=\"?Page=Photobook&&Album=".$_GET['Album']."&&View=".$images[$count[0]]."\"><img src=\"".$directory."/".$thumb."/".$images[$count[0]]."\" title=\"".$directory."/".$thumb."/".$images[$count[0]]."\"/></a>";
} else {
$html .= " ";
}
$html .= "</td>";
}
// END
// THIS
$html .= "<td height=\"".$thumb_size."\" width=\"".$thumb_size."\">";
$count = array_keys ( $images , $_GET['View'] );
if ( array_key_exists ( $count[0], $images ) ) {
$html .= "<img src=\"".$directory."/".$thumb."/".$images[$count[0]]."\" title=\"".$directory."/".$thumb."/".$images[$count[0]]."\"/>";
} else {
$html .= " ";
}
$html .= "</td>";
// END
// 1 NEXT
for ( $i=0; $i < ($slide-1)/2; $i++ ) {
$html .= "<td height=\"".$thumb_size."\" width=\"".$thumb_size."\">";
$count[0]++;
if ( array_key_exists ( ( $count[0] ), $images ) ) {
$html .= "<a href=\"?Page=Photobook&&Album=".$_GET['Album']."&&View=".$images[$count[0]]."\"><img src=\"".$directory."/".$thumb."/".$images[$count[0]]."\" title=\"".$directory."/".$thumb."/".$images[$count[0]]."\"/></a>";
//$count[0]--;
} else {
$html .= " ";
//$count[0]--;
}
$html .= "</td>";
}
// END
$html .="</tr>";
} else {
// Thumbs met link maken
foreach ( $images as $image ) {
if ( !file_exists ( $directory."/".$thumb . "/" . $image ) ) {
img_resize( $width = 90, $height = 90 , $image = $image, $path = $thumb );
}
$html .= "<a href=\"?Page=Photobook&&Album=".$_GET['Album']."&&View=".$image."\"><img src=\"". $directory."/".$thumb ."/". $image."\" title=\"". $directory."/".$thumb ."/". $image ."\"/></a>\n";
}
// End of Thumbs met link maken
}
// tabel afmaken
$html .= "</table>\n</center>\n<!-- End of Automatic Filled Table -->\n\n";
return $html;
}
?>
Ik hoop dat het duidelijk is, anders hoor ik het graag!
1.572 views