This is the code. I am using this to display thumbnails of all images in a directory and then create links to the pictures in a pop up window.
<?
$dir = opendir(".");
while($file=readdir($dir)) {
?>
<table width="100%">
<tr>
<td width="31%">
<div align="center"><font size="2">
<? echo ("<a href=javascript:popUp('$file')> <img src=$file width=100 height=80 border=0></a> ");?> </font></div></td>
<td width="33%">
<div align="center"><font size="2">
<?echo ("<a href=javascript:popUp('$file')> <img src=$file width=100 height=80 border=0></a><BR> ");?></font></div></td>
<td width="36%">
<div align="center"><font size="2">
<? echo ("<a href=javascript:popUp('$file')> <img src=$file width=100 height=80 border=0></a><BR> ");?></font></div></td>
<? } ?>
</tr>
</table>