27. juli 2003 - 02:42Der er
13 kommentarer og 1 løsning
Sortere billeder i mappe
Jeg har dette script som tager alle billeder i en mappe og viser dem på siden....
Problemet er bare, at billederne kommer i noget der i mine øjne ligner tilfælgig rækkefølge... Billederne er taget med digitalkamera og har derfor navne som PIC_203.jpg
<table width="100%"><?php function getcomment($billede) { include("database.php"); mysql_connect($server, $db_user, $db_pass) or die ("Database fejl"); mysql_select_db($database); $userID = $usid; $result = mysql_query("SELECT tekst FROM billedebeskrivelse WHERE billede='$billede' ORDER BY id DESC LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ if (!empty($row[tekst])) { echo "<br>$row[tekst]"; } else { echo "<br>-"; } } }
$default_dir = "./billeder/kampe/".$_GET[folder]; // Relative to current location $count = 1; $getfolder = $_GET[folder]; if(!($dp = opendir($default_dir))) die("Kunne ikke finde galleriet $default_dir"); $result = mysql_query("SELECT * FROM galleri WHERE mappe='$getfolder' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ $beskrivelse = nl2br($row[beskrivelse]); echo "<font size=+1>$row[navn]</font><br>$beskrivelse<br><br>"; } $overall = 1; while($file = readdir($dp)){ if($file != '.' && $file != '..' && stristr($file,"jpg")) { if ($count == 4) { echo "<tr>"; $count = 1; } echo "<td><a href=\"index.php?inc=visbillede.php&pic=$overall&folder=$_GET[folder]\"><center><img border=0 src=\"./gen.php?$default_dir/$file\"></a>"; $overall=$overall+1; getcomment("$default_dir/$file"); echo "</center></td>\r\n"; if ($count == 4) { echo "<tr>"; $count = 1; } $count=$count+1; } } echo "</table>"; ?>
<table width="100%"><?php function getcomment($billede) { include("database.php"); mysql_connect($server, $db_user, $db_pass) or die ("Database fejl"); mysql_select_db($database); $userID = $usid; $result = mysql_query("SELECT tekst FROM billedebeskrivelse WHERE billede='$billede' ORDER BY id DESC LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ if (!empty($row[tekst])) { echo "<br>$row[tekst]"; } else { echo "<br>-"; } } }
$default_dir = "./billeder/kampe/".$_GET[folder]; // Relative to current location $count = 1; $getfolder = $_GET[folder]; if(!($dp = opendir($default_dir))) die("Kunne ikke finde galleriet $default_dir"); $result = mysql_query("SELECT * FROM galleri WHERE mappe='$getfolder' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ $beskrivelse = nl2br($row[beskrivelse]); echo "<font size=+1>$row[navn]</font><br>$beskrivelse<br><br>"; } $overall = 1; while (($fil = readdir($dp)) !== false) { if ($fil != "." && $fil != ".." && !is_dir($mappe."/".$fil) && stristr($file,"jpg")) { $billeder[] = "$fil"; } } closedir($handle); sort($billeder); while($billeder[$i] != "") { if ($count == 4) { echo "<tr>"; $count = 1; } echo "<td><a href=\"index.php?inc=visbillede.php&pic=$overall&folder=$_GET[folder]\"><center><img border=0 src=\"./gen.php?$default_dir/$file\"></a>"; $overall=$overall+1; getcomment("$default_dir/$file"); echo "</center></td>\r\n"; if ($count == 4) { echo "<tr>"; $count = 1; } $count=$count+1; } echo "</table>"; ?>
<table width="100%"><?php function getcomment($billede) { include("database.php"); mysql_connect($server, $db_user, $db_pass) or die ("Database fejl"); mysql_select_db($database); $userID = $usid; $result = mysql_query("SELECT tekst FROM billedebeskrivelse WHERE billede='$billede' ORDER BY id DESC LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ if (!empty($row[tekst])) { echo "<br>$row[tekst]"; } else { echo "<br>-"; } } }
$default_dir = "./billeder/kampe/".$_GET[folder]; // Relative to current location $count = 1; $getfolder = $_GET[folder]; if(!($dp = opendir($default_dir))) die("Kunne ikke finde galleriet $default_dir"); $result = mysql_query("SELECT * FROM galleri WHERE mappe='$getfolder' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ $beskrivelse = nl2br($row[beskrivelse]); echo "<font size=+1>$row[navn]</font><br>$beskrivelse<br><br>"; } $overall = 1; while (($fil = readdir($dp)) !== false) { if ($fil != "." && $fil != ".." && !is_dir($mappe."/".$fil) && stristr($file,"jpg")) { $billeder[] = "$fil"; } } sort($billeder); while($billeder[$i] != "") { if ($count == 4) { echo "<tr>"; $count = 1; } echo "<td><a href=\"index.php?inc=visbillede.php&pic=$overall&folder=$_GET[folder]\"><center><img border=0 src=\"./gen.php?$default_dir/$file\"></a>"; $overall=$overall+1; getcomment("$default_dir/$file"); echo "</center></td>\r\n"; if ($count == 4) { echo "<tr>"; $count = 1; } $count=$count+1; } echo "</table>"; ?>
Warning: is_dir() [function.is-dir]: SAFE MODE Restriction in effect. The script whose uid is 65534 is not allowed to access / owned by uid 0 in /STORE/fcknet_dk/public_html/thumbs.php on line 28
<table width="100%"><?php function getcomment($billede) { include("database.php"); mysql_connect($server, $db_user, $db_pass) or die ("Database fejl"); mysql_select_db($database); $userID = $usid; $result = mysql_query("SELECT tekst FROM billedebeskrivelse WHERE billede='$billede' ORDER BY id DESC LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ if (!empty($row[tekst])) { echo "<br>$row[tekst]"; } else { echo "<br>-"; } } }
$default_dir = "./billeder/kampe/".$_GET[folder]; // Relative to current location $count = 1; $getfolder = $_GET[folder]; if(!($dp = opendir($default_dir))) die("Kunne ikke finde galleriet $default_dir"); $result = mysql_query("SELECT * FROM galleri WHERE mappe='$getfolder' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ $beskrivelse = nl2br($row[beskrivelse]); echo "<font size=+1>$row[navn]</font><br>$beskrivelse<br><br>"; } $overall = 1; while (($fil = readdir($dp)) !== false) { if ($fil != "." && $fil != ".." && !is_dir($default_dir."/".$fil) && stristr($file,"jpg")) { $billeder[] = "$fil"; } } sort($billeder); while($billeder[$i] != "") { if ($count == 4) { echo "<tr>"; $count = 1; } echo "<td><a href=\"index.php?inc=visbillede.php&pic=$overall&folder=$_GET[folder]\"><center><img border=0 src=\"./gen.php?$default_dir/$file\"></a>"; $overall=$overall+1; getcomment("$default_dir/$file"); echo "</center></td>\r\n"; if ($count == 4) { echo "<tr>"; $count = 1; } $count=$count+1; } echo "</table>"; ?>
<table width="100%"><?php function getcomment($billede) { include("database.php"); mysql_connect($server, $db_user, $db_pass) or die ("Database fejl"); mysql_select_db($database); $userID = $usid; $result = mysql_query("SELECT tekst FROM billedebeskrivelse WHERE billede='$billede' ORDER BY id DESC LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ if (!empty($row[tekst])) { echo "<br>$row[tekst]"; } else { echo "<br>-"; } } }
$default_dir = "./billeder/kampe/".$_GET[folder]; // Relative to current location $count = 1; $getfolder = $_GET[folder]; if(!($dp = opendir($default_dir))) die("Kunne ikke finde galleriet $default_dir"); $result = mysql_query("SELECT * FROM galleri WHERE mappe='$getfolder' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ $beskrivelse = nl2br($row[beskrivelse]); echo "<font size=+1>$row[navn]</font><br>$beskrivelse<br><br>"; } $overall = 1; while (($fil = readdir($dp)) !== false) { if ($fil != "." && $fil != ".." && !is_dir($default_dir."/".$fil) && stristr($fil,"jpg")) { $billeder[] = "$fil"; } } sort($billeder); while($billeder[$i] != "") { if ($count == 4) { echo "<tr>"; $count = 1; } echo "<td><a href=\"index.php?inc=visbillede.php&pic=$overall&folder=$_GET[folder]\"><center><img border=0 src=\"./gen.php?$default_dir/$file\"></a>"; $overall=$overall+1; getcomment("$default_dir/$file"); echo "</center></td>\r\n"; if ($count == 4) { echo "<tr>"; $count = 1; } $count=$count+1; } echo "</table>"; ?>
<?php function getcomment($billede) { include("database.php"); mysql_connect($server, $db_user, $db_pass) or die ("Database fejl"); mysql_select_db($database); $userID = $usid; $result = mysql_query("SELECT tekst FROM billedebeskrivelse WHERE billede='$billede' ORDER BY id DESC LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ if (!empty($row[tekst])) { echo "<br>$row[tekst]"; } else { echo "<br>-"; } } } $default_dir = "./billeder/kampe/".$_GET[folder]; // Relative to current location $count = 1; $getfolder = $_GET['folder']; ?>
<table width="100%">
<?php if(!($dp = opendir($default_dir))) die("Kunne ikke finde galleriet $default_dir");
$result = mysql_query("SELECT * FROM galleri WHERE mappe='$getfolder' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ $beskrivelse = nl2br($row['beskrivelse']); echo "<font size=+1>$row[navn]</font><br>$beskrivelse<br><br>"; } $overall = 1; closedir($dp); $handle = opendir($default_dir); while (($fil = readdir($handle)) !== false) { if ($fil != "." && $fil != ".." && !is_dir($default_dir."/".$fil) && stristr($file,"jpg")) { $file[] = "$fil"; } }
<?php function getcomment($billede) { include("database.php"); mysql_connect($server, $db_user, $db_pass) or die ("Database fejl"); mysql_select_db($database); $userID = $usid; $result = mysql_query("SELECT tekst FROM billedebeskrivelse WHERE billede='$billede' ORDER BY id DESC LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ if (!empty($row[tekst])) { echo "<br>$row[tekst]"; } else { echo "<br>-"; } } } $default_dir = "./billeder/kampe/".$_GET[folder]; // Relative to current location $count = 1; $getfolder = $_GET['folder']; ?>
<table width="100%">
<?php if(!($dp = opendir($default_dir))) die("Kunne ikke finde galleriet $default_dir");
$result = mysql_query("SELECT * FROM galleri WHERE mappe='$getfolder' LIMIT 1") or die (mysql_error()); while($row = mysql_fetch_array($result)){ $beskrivelse = nl2br($row['beskrivelse']); echo "<font size=+1>$row[navn]</font><br>$beskrivelse<br><br>"; } $overall = 1; closedir($dp); $handle = opendir($default_dir); while (($fil = readdir($handle)) !== false) { if ($fil != "." && $fil != ".." && !is_dir($default_dir."/".$fil) && stristr($fil,"jpg")) { $file[] = "$fil"; } }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.