Hjælp til php pic-viewer
Hej eksperterjeg har et lille problem....
jeg har et php script som jeg ikke kan få til at virke som jeg vil have den til det.
den kan sagtens vise hvilke billeder der er i undermappen men ikke selve billederne. den giver denne sti:
http://www.friserverplads.dk/grydgaard/living.JPG
stien stille se sådan ud:
http://www.friserverplads.dk/grydgaard/pic/living.JPG
her er mit script:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Tommys billede side</title>
</head>
<body text="#0000ff" link="#0000ff" alink="#0000ff" vlink="#0000ff" allowTransparency="true" STYLE="background-color:transparent;">
<?php
$fornext=1;
$next="<b>>></b>";
$last="<b><<</b>";
$textlinks=1;
$dropdown=1;
$dropdowntext="show";
$namedisp=1;
$xofy=1;
$SCRIPT_NAME=$SERVER_VARS['PHP_SELF'];
$pic=$HTTP_GET_VARS['pic'];
$handle=opendir('./xpic/');
echo "<div align=\"center\">\n\t<font face=\"verdana,arial,helvetica\" size=2>\n";
$pics=array();
$count=0;
while (($file = readdir($handle))!==false) {
if (substr($file,-4) == ".jpg" || substr($file,-4) == ".gif" || substr($file,-4) == ".png" || substr($file,-4) == ".JPG" || substr($file,-4) == ".GIF" || substr($file,-4) == ".PNG"){
$pics[$count] = $file;
$count++;
}
}
closedir($handle);
sort($pics);
reset($pics);
for ($f=0;$f<=sizeof($pics)-1;$f++){if ($pic==$pics[$f]){$selected = $f+1;}}
if ($dropdown==1){
echo "\t\t<!-- dropdown -->\n\t\t<form name=\"mainform\">\n\t\t\t<select name=\"pic\">\n";
for ($f=0;$f<=sizeof($pics)-1;$f++){
$name=ucfirst(substr($pics[$f],0,-4));
if ($pic==$pics[$f]){echo "\t\t\t\t<option value=\"".$pics[$f]."\" selected>".$name."</option>\n";}
else{echo "\t\t\t\t<option value=\"".$pics[$f]."\">".$name."</option>\n";}
}
echo "\t\t\t</select>\n\t\t\t <input type=\"submit\" value=\"".$dropdowntext."\">\n\t\t</form>\n\t\t<!-- end dropdown -->";
}
if ($pic && !preg_match("/javascript/",$pic)){
if ($namedisp==1){
$name=ucfirst(substr($pic,0,-4));
echo "\n\t\t<!-- imagename -->\n\t\t<b>".$name;
}
if ($xofy==1){
echo " ".$selected."/".sizeof($pics);
}
echo "</b>\n\t\t<!-- imagename end -->\n";
echo "\t\t<!-- table with image -->\n\t\t<table width=1 border=0 cellspacing=0 cellpadding=1>\n\t\t\t<tr>\n\t\t\t\t<td>";
if ($selected != 1 && $fornext==1){
echo "<a href=\"$SCRIPT_NAME?pic=".$pics[$selected-2]."\">$last</a>";
}
else { echo "<font color=\"".$bg."\">$last</font>";}
echo"</td>\n\t\t\t\t<td><image src=\"".$pic."\" alt=\"".$name."\" border=0></td>";
if ($selected != (sizeof($pics)) && $fornext==1){
echo"\n\t\t\t\t<td><a href=\"$SCRIPT_NAME?pic=".$pics[$selected]."\">$next</a>";
}
else { echo"\n\t\t\t\t<td><font color=\"".$bg."\">$next</font>";}
echo"</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<!-- table with image end -->\n\t\t<!-- Textlinks--->\n\t\t";
}
if ($textlinks == 1){
for ($f=0;$f<=sizeof($pics)-1;$f++){
if ($f > 0) echo " ";
if ($pic==$pics[$f]){echo "<b>".($f+1)."</b>";}
else{echo "<a href=\"$SCRIPT_NAME?pic=".$pics[$f]."\">".($f+1)."</a>";}
$isbr = strpos((($f+1)/15),".");
if (!$isbr){echo "<br>";}
}
}
echo"\n\t\t<!-- end textlinks -->\n\t</font></div>";
?>
</body>
</html>
jeg håber at jeg kan få lidt hjælp til det.
