Nou zoals de topic het al zegt ik wil graag een tabel maken om de fotos die gegereneerd worden!
ik heb al beetje geprobeerd maar ik ben nog niet egt bepaald goed in PHP duz vandaar dat ik hier ff om hulp vraag. Weet iemand hoe ik dat kan doet met het volgende script


<?php


//Configuration
//Title for your gallery that will be used with the default header.
$title="Titel";

// Logo for the site. Use HTML it can be a graphic.
//$logo='<a href="'.$_SERVER['PHP_SELF'].'" target="_top"><img alt="Your Logo Here" src="http://www.lgr.ca/images/lgrlogo.gif" height="60" width="300" align="right" border="0" /></a>';
$logo='';

//Thumbnail maker. Some servers don't like this. Defualt is to leave it on. If you have trouble turn it off.
//0=off 1=on
$makethumbs=1;

//Thumbnail extension. You can change the thumbnail filename extesntion that is added onto the end of the original filename.
//Thumbnail file name will be "OriginalFilename.jpg_thmb.jpg" Warning if you leave this blank you will overwrite your original files!
//If you change the extension it will create new thumbnail files, but not delete the old ones.
// default=_thmb.jpg
$thumbext='_thmb.jpg';


//Thumbnail size. The minimum width and height in pixels, that you would like the thumbnails to be. Photos are scaled.
$twidth=150;
$theight=150;


//Photo size. The minimum width and height in pixels, that you would like you photos scaled to when displayed.
$pwidth = 640;
$pheight = 640;

//The thumbnail gallery is displayed in a table. Please choose the number of rows and columns you would like.
$rows=3;
$cols=5;

//If you would like the filename of the photo to be displayed under the thumbnail change this setting.
//0=off 1=on
$showfilename=0;
$showpathname=0;

//If you would like photo to up a new window when clicked change this setting.
//The defualt is to open the image up in the same browser window.
//0=off 1=on
$window=0;

//Use Javascript for new window
//0=off 1=on
$javascript=0;

//If you would like the thumb to link directly to the photo and not the script set this.
//This works best if you use the Javascript window. It pops open in a nice size.
//Default is to the script.
//0=off 1=on
$linktophoto=0;

//If you would like to use a custom header or footer please add the file names here and they will be included in the script.
//Otherwise the plain jane default will be used. The files should be in the same folder as the script, but if you provide an
//alternate path it will work as well. Example: header.html, header.php. 
$header="NULL";
$footer="NULL";
$stylesheet="styles.css";
$divider=" | ";

//No need to mess with anything below here.
//Part of this function comes from http://www.php.net/manual/en/function.getimagesize.php
function thumb_maker($filename, $minwidth, $minheight) {
	global $thumbext,$makethumbs;
	if ($makethumbs==1) {
		if (file_exists($filename.$thumbext)) {
			$photosize = getimagesize($filename.$thumbext);
			if (max($minwidth,$minheight)!=max($photosize[0],$photosize[1])) {
			unlink($filename.$thumbext);
			}		
		}
		if (!file_exists($filename.$thumbext) && file_exists($filename)) {
			echo "<br/>One moment please....creating a thumbnail.";
			set_time_limit(60);
			$photosize = getimagesize($filename);
		    // Get image size and scale ratio
		    $scale = min($minwidth/$photosize[0], $minheight/$photosize[1]);
			if ($scale < 1) {
			   $width = floor($scale*$photosize[0]);
			   $height = floor($scale*$photosize[1]);
			}
			else {
			   $width = $minwidth;
			   $height = $minheight;
			}
			if ($photosize[mime]=="image/jpeg") {
				$resizedimage = imagecreatetruecolor($width, $height);
				$thumbimage = imagecreatefromjpeg($filename);
				imagecopyresampled($resizedimage, $thumbimage, 0, 0, 0, 0, $width, $height, $photosize[0], $photosize[1]);
				imagejpeg($resizedimage,$filename.$thumbext,50);
				imageDestroy($resizedimage); 
				imageDestroy($thumbimage); 
			}
		}
	}
}

//Part of this function comes from http://www.php.net/manual/en/function.getimagesize.php
function gallery_sizer($photo,$minwidth,$minheight) {
	if (file_exists($photo)) {
		$photosize = getimagesize("$photo");
	    # Get image size and scale ratio
	    $scale = min($minwidth/$photosize[0], $minheight/$photosize[1]);
		if ($scale <= 1) {
			$width = floor($scale*$photosize[0]);
			$height = floor($scale*$photosize[1]);
		}
		else {
			$width = floor($photosize[0]);
			$height = floor($photosize[1]);
		}
		return array($width,$height,$photosize[0],$photosize[1]);
	}
}

function getdirs($dir) {
	$dirs=array();
	chdir($dir);
	if ($handle = opendir($dir)) {
	    while (false !== ($file = readdir($handle))) {
	        if ($file != "." && $file != ".."){
				if (is_dir($file)) {
	        		$dirs[] = $file;
				}
	        }
	    }
	    closedir($handle);
	}
	sort($dirs);
	return $dirs;
}


function getphotos($photodir) {
	global $thumbext;
	$photos=array();
	if ($handle = opendir($photodir)) {
	    while (false !== ($file = readdir($handle))) {
	        if ($file != "." && $file != ".." && !eregi(".jpg".$thumbext."$",$file) && eregi(".jpg$",$file)){
	                $photos[] = $file;
	        }
	    }
	    closedir($handle);
	}
	sort($photos);
	return $photos;
}
		
function thumb_gallery($photonum) {
	global $photos, $photourl, $photodir, $twidth, $theight, $rows, $cols, $showfilename,$showpathname,$linktophoto,$thumbext, $album, $window, $javascript;
		if ($photonum>count($photos)-1) {
			$photonum=count($photos)-1;
		}
		if (($photonum)<=0) {
			$photonum=0;
		}

		if(isset($album)) { $query="&amp;album=".urlencode($album); }
		for ($tr = 1; $tr <= $rows; $tr++) {
			$photobody[]="<tr>";
			for ($td = 1; $td <= $cols; $td++) {
				$photobody[]="<td align=\"center\">";
				if (file_exists($photodir."/".$photos[$photonum].$thumbext)) {
					$size=gallery_sizer($photodir."/".$photos[$photonum].$thumbext,$twidth,$theight);
					$jswindowsize=gallery_sizer($photodir."/".$photos[$photonum],1,1);
					$link = $photourl."/".$photos[$photonum].$thumbext;
					if ($linktophoto==1) { $linktarget="http://".$_SERVER[HTTP_HOST].$photourl."/".$photos[$photonum]; } else { $linktarget="http://".$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF]."?p=".urlencode($photos[$photonum]).$query; }
					if ($window==1) { if ($javascript==1) { $linktarget='javascript:Popup(\''.$linktarget.'\',\''.($jswindowsize[2]+15).'\',\''.($jswindowsize[3]+15).'\')';	} else { $target="_blank"; } } else { $target="_self"; }
					if ($photonum<=count($photos)-1) {

					if ($javascript==0) {
						$photobody[]="<a href=\"$linktarget\" target=\"$target\">";
						}
					else {  $photobody[]="<a href=\"$linktarget\">"; }
					}
						$photobody[]="<img src=\"$link\" width=\"$size[2]\" height=\"$size[3]\" alt=\"$photos[$photonum]\" border=\"1\" /></a><br />";
				}
				if ($photos[$photonum]) {
					if ($showfilename==1) { $photobody[]=$photos[$photonum]; }
					if ($showpathname==1) { $photobody[]="<br />http://".$_SERVER[HTTP_HOST].$photourl."/".$photos[$photonum]; }
				}				
				$photobody[]="</td>";
				$photonum++;
			}
			$photobody[]="</tr>";
		}
		unset($tr, $td);
	
		#this is down here for a reason don't move it and use array_unshift instead. Trust me.
		if (($photonum-($rows*$cols))>0) { $prev="<a href=\"$_SERVER[PHP_SELF]?pn=".($photonum-(($rows*$cols)*2)).$query."\"><< Vorige Pagina</a>"; }
		if (($photonum)<(count($photos))) { $next="<a href=\"$_SERVER[PHP_SELF]?pn=".$photonum.$query."\">Volgende Pagina >></a>"; }
		
		$photopage=array();
		$photopage[]="Pagina: ";
		for ($pagelink=0, $pagenum=1; $pagelink<=count($photos); $pagelink+=($rows*$cols), $pagenum++) {
			$photopage[]="<a href=\"$_SERVER[PHP_SELF]?pn=".($pagelink).$query."\">$pagenum</a> | ";
		}
		unset($pagelink, $pagenum);
		$photopage=implode("", $photopage);	

		if ($photonum >= count($photos)) { $endnum=count($photos); } else { $endnum=$photonum; }
		$photobody[]="<tr><td colspan=\"".$cols."\"><table width=\"100%\" border=\"0\"><tr><td width=\"33%\"><div align=\"left\">".$prev."</div></td><td width=\"33%\"><div align=\"center\" class=\"caption\">Foto's <strong>".($photonum-(($rows*$cols)-1))."</strong> van <strong>".$endnum."</strong> Totaal: <strong>".count($photos)."</strong><br />".$photopage."</div></td><td width=\"33%\"><div align=\"right\">".$next."</div></td></tr></table></td></tr>";
		array_unshift($photobody, "<tr><td colspan=\"".$cols."\"><table width=\"100%\" border=\"0\"><tr><td width=\"33%\"><div align=\"left\">".$prev."</div></td><td width=\"33%\"><div align=\"center\">Foto's <strong>".($photonum-(($rows*$cols)-1))."</strong> van <strong>".$endnum."</strong> Totaal: <strong>".count($photos)."</strong><br />".$photopage."</div></td><td width=\"33%\"><div align=\"right\">".$next."</div></td></tr></table></td></tr>");

		#put the table tag at the top of the array.
		array_unshift($photobody, '<table width="100%" border="0" cellspacing="0" cellpadding="3">');
		$photobody[]='</table>';

		if ($window==1 && $javascript=1) {
			array_unshift($photobody, '<SCRIPT language="JavaScript">function Popup(url,width,height) { PopupWindow = window.open (\'\', \'PopupWindow\',\'scrollbars=0,resizable=1,height=\'+height+\',width=\'+width+\',left=100,top=20\'); PopupWindow.focus(); PopupWindow.location.href = url; }</SCRIPT>');
		}		
		
	return $photobody;
}

function photo_gallery($photo) {
	global $photodir, $photourl, $pwidth, $pheight, $thumbsurl, $window, $photos, $album, $thumbext, $header;
	$photobody=array();
	
	if (isset($photo)) {

		if(isset($album)) { $query="&amp;album=".urlencode($album); }
    foreach ($photos as $key => $value) {
    	 if($photo==$value) {
    		if($photos[$key+1]) {
    			$nextphoto="<br /><a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key+1].$query."\">Volgende Foto &gt;</a>";
    			$nextphotothumb="<a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key+1].$query."\"><img alt=\"\" src=\"".$photourl."/".$photos[$key+1].$thumbext."\" height=\"50\" border=\"1\" /></a>";
    		}
    		if($photos[$key-1]) {
    			$prevphoto="<br /><a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key-1].$query."\">&lt; Vorige Foto</a>";
    			$prevphotothumb="<a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key-1].$query."\"><img alt=\"\" src=\"".$photourl."/".$photos[$key-1].$thumbext."\" height=\"50\" border=\"1\" /></a>";
    		}
    	 }
    }
		if ($window==1) { $target="<a href=\"javascript:window.close()\">Close Window</a>"; } else { $target="<a href=\"".$_SERVER[HTTP_REFERER]."\"><< Vorige Pagina Page</a>"; }
		$size=gallery_sizer("$photodir/$photo",$pwidth,$pheight);
		$photobody[]='<table width="100%" border="0" cellspacing="0" cellpadding="3">';

		$photobody[]="<tr class=\"imageborder\"><td width=\"33%\"></td><td align=\"center\" width=\"33%\"><div align=\"center\" class=\"caption\"></div></td><td align=\"right\" width=\"33%\"></td></tr>";
		
		$photobody[]="<tr class=\"imageborder\"><td width=\"33%\">".$prevphotothumb.$prevphoto."</td><td align=\"center\" width=\"33%\"><div align=\"center\" class=\"caption\">";
		if ($header=="NULL") {
  		if (isset($album)) { $photobody[]="<a href=\"".$_SERVER[PHP_SELF]."?album=".urlencode($album)."&amp;p=".$photo."&amp;slide=1\">Start Slideshow</a>\n"; }
  		else { $photobody[]="<a href=\"".$_SERVER[PHP_SELF]."?p=".$photo."&amp;slide=1\">Start Slideshow</a>\n"; }
		}		
		$photobody[]="</div></td><td align=\"right\" width=\"33%\">".$nextphotothumb.$nextphoto."</td></tr>";
		$photobody[]='<tr><td colspan="3" align="center">';
		$photobody[]='<img src="'.$photourl.'/'.$photo.'" width="'.$size[0].'" height="'.$size[1].'" border="0" alt="" class="imageborder" />';
		$photobody[]='</td></tr>';
		$photobody[]='</table>';
	}
	return $photobody;
}

function photo_slides($photo) {
	global $photodir, $photourl, $pwidth, $pheight, $thumbsurl, $window, $photos, $album, $header;
	$photobody=array();
	
	if (isset($photo)) {

		if(isset($album)) { $query="&amp;album=".urlencode($album); }

    foreach ($photos as $key => $value) {
    
    	 if($photo==$value) {
    
    		if($photos[$key+1]) {
    			$nextphoto="<br /><a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key+1].$query."\"> Volgende </a>";
    			$nextphotothumb="<a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key+1].$query."\"><img alt=\"\" src=\"".$photourl."/".$photos[$key+1].$thumbext."\" height=\"50\" border=\"1\" /></a>";
    		}
    		if($photos[$key-1]) {
    			$prevphoto="<br /><a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key-1].$query."\">&lt;&lt; Vorige Foto</a>";
    			$prevphotothumb="<a href=\"".$_SERVER[PHP_SELF]."?p=".$photos[$key-1].$query."\"><img alt=\"\" src=\"".$photourl."/".$photos[$key-1].$thumbext."\" height=\"50\" border=\"1\" /></a>";
    		}
    	 }
    }
		$size=gallery_sizer("$photodir/$photo",$pwidth,$pheight);
		$photobody[]='<table width="100%" border="0" cellspacing="0" cellpadding="3">';

		$photobody[]="<tr class=\"imageborder\"><td width=\"33%\">".$prevphotothumb.$prevphoto."</td><td align=\"center\" width=\"33%\"><div align=\"center\" class=\"caption\">";
		if ($header=="NULL") {
  		if (isset($album)) { $photobody[]="<a href=\"".$_SERVER[PHP_SELF]."?album=".urlencode($album)."&amp;p=".$photo."\">Stop Slideshow</a>\n"; }
  		else { $photobody[]="<a href=\"".$_SERVER[PHP_SELF]."?p=".$photo."\">Stop Slideshow</a>\n"; }	
		}
		$photobody[]="</div></td><td align=\"right\" width=\"33%\">".$nextphotothumb.$nextphoto."</td></tr>";
		
		if ($window==1) { $target="<a href=\"javascript:window.close()\">Close Window</a>"; } else { $target="<a href=\"".$_SERVER[HTTP_REFERER]."\">Back</a>"; }
		$photobody[]='<tr><td colspan="3" align="center">';
		$photobody[]='<img src="'.$photourl.'/'.$photo.'" width="'.$size[0].'" height="'.$size[1].'" border="0" alt="" class="imageborder" />';
		$photobody[]='</td></tr>';
		$photobody[]='</table>';
	}
	return $photobody;
}

function display($photobody) {
	global $photodir;
	getheader();
	echo "";
	albums(dirname($_SERVER['SCRIPT_FILENAME']));
	echo "<div class=\"photobody\">";
	foreach ($photobody as $value) {
	   echo $value."\n";
	}
	echo "</div>";	
	getfooter();
	exit;
}

function albums($dir) {
//for now only one level of albums works.
	global $album, $title, $photos, $divider, $logo, $photo;
	$dirs=getdirs($dir);
	if (isset($logo)) { echo $logo; }
	if (isset($album)) { echo "<h1>".$album."</h1>"; } else { echo "<center><h1>".$title."</h1></center><p>Foto Albums Beschikbaar</p>"; }

	echo "<div class=\"album\"><p>";
	if (isset($album) || isset($photo)) { echo "<a href=\"".$_SERVER[PHP_SELF]."\">$title Home</a>$divider\n"; }
	else {  }
	if (count($dirs)>0) {
		foreach ($dirs as $value) {
		   echo "<a href=\"".$_SERVER[PHP_SELF]."?album=".urlencode($value)."\">".$value."</a>$divider\n";
		}
	}
//	echo "<img src=\"" width=\"1\" height=\"1\" alt=\"\" /></p></div>";
	echo "</p></div>";
}

//returns the header for the page. Checks for a user defined header.
function getheader() {
	global $header, $title, $slide, $photodir, $photourl, $pwidth, $pheight, $thumbsurl, $window,$photo, $photos, $album, $stylesheet;

	if(isset($album)) { $query="&amp;album=".urlencode($album); }
	if ($slide==1) { $query=$query."&amp;slide=1"; } 
	
foreach ($photos as $key => $value) {
	 if($photo==$value) {
		if($photos[$key+1]) {
			$nextslide=$_SERVER[PHP_SELF]."?p=".$photos[$key+1].$query;
		}
		elseif (!$photos[$key+1]) {
			$slide=0;
		}
	}
}	
	
	
	if (isset($header) && $header!="NULL" && is_file ($header)) {
		require("$header");
	}
	else {
		echo "\n";
		echo '<head>';
		echo '<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />';
		echo "\n";
		echo "<title>$title</title>\n";
		echo '<meta name="Author" content="Blaat" />';
		if ($slide==1 && $header=="NULL") { echo "<META HTTP-EQUIV=refresh CONTENT=\"4; URL=".$nextslide." \">"; }
		echo '<style type="text/css" media="all">@import "'.$stylesheet.'";</style>';
		echo "\n";
		echo '</head>';
		echo "\n";
		echo '<body>';
		echo "\n";
		echo '<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="100%">';
		echo '<tr>';
		echo '<td width="100%">&nbsp;</td>';



	}

}
//returns the footer for the page. Checks for a user defined footer.
function getfooter() {
	global $footer;
	if (isset($footer) && $footer!="NULL" && is_file ($footer)) {
		require("$footer");
	}
	else {
echo '</tr>';
echo '</table>';
echo '<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">';
echo '<tr>';
echo '<td width="100%" bgcolor="#000000">';
echo '<p align="center"><font color="#FFFFFF"><h2>© testje ©</2></font></td>';
echo '</tr>';
echo '</table>';
echo "</body>\n</html>";

	}
}

$photodir=dirname($_SERVER['SCRIPT_FILENAME']);
$photourl=dirname($_SERVER['PHP_SELF']);
$thumbsurl=dirname($_SERVER['PHP_SELF']);
$photobody=array();

if (isset($_GET[album])) {
	if (in_array($_GET[album],getdirs(dirname($_SERVER['SCRIPT_FILENAME'])))==FALSE) {
		$album = NULL;
	}
	else {
		$album = urldecode($_GET[album]);
	}
	$photodir=$photodir."/".$album;
	$photourl=$photourl."/".$album;
	$thumbsurl=$thumbsurl."/".$album;
}

//To make sure this works both on Linux and Win
$photodir = str_replace("\\", "/", $photodir);

//Get the jpegs from the folder.
$photos=getphotos($photodir);

//check to see if thumbnails are made if not it will make. Adds time to the processing of the script.
for ($i=0; $i<=count($photos)-1; $i++) {
	thumb_maker($photodir."/".$photos[$i], $twidth, $theight);
}


if (count($photos)<=0) {
	$photobody[]="";
	display($photobody);
	exit;
}
if (isset($_GET[pn])) {
	$photonum = $_GET[pn];
	$photobody=thumb_gallery($photonum);
}
elseif (isset($_GET[slide])) {
	$slide=$_GET[slide];
	$photo=urldecode($_GET[p]);
	$photobody=photo_slides($photo,$pwidth,$pheight);
}
elseif (isset($_GET[p])) {
	$photo=urldecode($_GET[p]);
	$photobody=photo_gallery($photo,$pwidth,$pheight);
}
else {
	$photobody=thumb_gallery(0);
}



//output it all to the browser.
display($photobody);
exit;
echo '</tr>';
echo '</table>';

?>
Have fun
D@rk schreef op 23.03.2005 16:36
Have fun


?? kan je helpen of niet?
Na 2,5 halve dag lezen kwam ik tot de conclusie dat ik nog geen idee heb....
:S
haha ja is wel lang script ik weet het
maar kheb al geprobeerd om hem in het begin neer te zette maar dan moet ik </table> ook ergens neerzette zodat hij t doet anders krijg ik eerst een lege tabel en dan de fotos :S
als ik het goed gelezen heb, draait alles om: display($photobody); , dus dan zou jee een tabel daaromheen moeten bouwen:
echo "<table><tr><td>";
display($photobody);
echo "</td></tr>";

heb het niet geprobeerd... maar is het proberen waard denk ik
kheb geprobeerd maar hij doet t niet :S
hij komt er nog steeds boven de fotos te staan :S
Moet je ff met GD iets leuks doen... ff zoeken op php.net...

//edit:

een huidig gd script (stats) gebruikt imagerectangle voor een randje om het plaatje... moet je maar ff kijken of je der iets meej kan... :)
eeehm johan ik denk dat je het verkeerd begrepen heb.. Ofk heb jou verkeerd begrepen
maar ik bdoel dat hij een tabel gaat maken om alle thumbnails! gwoon een tabel waar alle thumbnails in worden gegenereerd
Ok laat maar zitte het is al glukt
Ik heb een prachtig fotoscript ontwikkeld, kun je zelf bepalen hoveel thumbs naast elkaar, kolommen, en als je dr op klikt krijg je een slide show, met volgende en vorige.

Werkt perfect!

Reageren