ændring af galleri script
JEg har fundet nedenstående script, som kan lige det jeg skal bruge det til - næste. Jeg vil meget gerne have vist billed navnet under hvert billede - er der nogen der kan hjælpe med det?Scriptet:
function fType($file) {
$varFileType = filetype($file);
if($varFileType != "dir") {
$curdir = getcwd();
$pInfo = pathinfo("$curdir/$file");
$varFileType = $pInfo["extension"];
}
return $varFileType;
}
function fileView($file) {
$imgsize=getimagesize ("$file");
$imgheight=($imgsize[1]+25);
$imgwidth=($imgsize[0]+20);
$varType = strtolower(fType($file));
$varJSSettings = "width=$imgwidth,height=$imgheight,resizable=0,scrollbars=0,menubar=0,status=0,titlebar=0,toolbar=0,hotkeys=0,locationbar=0";
$txtArray[] = "jpg";
$txtArray[] = "gif";
if(in_array($varType, $txtArray)) {
$content = "<br><a href=\"#\" onClick=\"window.open('$file', 'viewer','$varJSSettings');\">view larger</a>";
}
return $content;
}
function dirGather() {
$handle=opendir(".");
$content = "";
//while (false!=($file = readdir($handle))) {
while ($file = readdir($handle)) {
if(($file != "index.php") && ($file != "thumbnail.php")) {
$filetype = fType($file);
if($filetype == "dir") {
$dirtext[] = "$file";
} else {
$context[] = "$file";
}
}
}
$columns = 3; // how many columns you want to have
echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"2\"><tr>"; //begin table
$i=0;
for ($x=0; $x <=count($context); $x++){ // start cell output
echo "<td>";
if ($context[$x]){
sort($context);
$viewfile = fileView($context[$x]);
echo "<div align=\"center\"><img src=\"thumbnail.php?gd=2&src=$context[$x]&maxw=100\">$viewfile</div>";
}
echo "</td>";
++$i; // end cell output
if($i == $columns) { // end row
print "</tr><tr>";
$i = 0;
}
}
echo "</tr></table>"; // end table
}
print dirGather(); // outputs image directory
Søren
