Kod
<?
if ($admaction == "addfrm_cfm"){
}
$cat_thmb = "../images/small";
$foto_thmb = $_FILES[foto_thmb]['name'];
if(is_uploaded_file($_FILES[foto_thmb]['tmp_name'])){
move_uploaded_file($_FILES[foto_thmb]['tmp_name'],
"$cat_thmb/$foto_thmb");
echo "<p class=\"alert\"><b>Upload miniaturki zakończony sukcesem.</b></p>";
}
?>
if ($admaction == "addfrm_cfm"){
}
$cat_thmb = "../images/small";
$foto_thmb = $_FILES[foto_thmb]['name'];
if(is_uploaded_file($_FILES[foto_thmb]['tmp_name'])){
move_uploaded_file($_FILES[foto_thmb]['tmp_name'],
"$cat_thmb/$foto_thmb");
echo "<p class=\"alert\"><b>Upload miniaturki zakończony sukcesem.</b></p>";
}
?>
Tego zaś używam do wyświetlania grafik:
Kod
<?php
function listfile($dir)
{
$tab=array(); $handle=opendir($dir);
while ($file = readdir($handle)){
if($file=='.'||$file=='..' || is_dir($dirname.$file)) continue;
array_push($tab,$file);}
closedir($handle);
return $tab;
}
$tab = listfile('images/small/');
foreach($tab as $value)
{
echo '<img src="images/small/'.$value.'" class="small" />';
}
?>
function listfile($dir)
{
$tab=array(); $handle=opendir($dir);
while ($file = readdir($handle)){
if($file=='.'||$file=='..' || is_dir($dirname.$file)) continue;
array_push($tab,$file);}
closedir($handle);
return $tab;
}
$tab = listfile('images/small/');
foreach($tab as $value)
{
echo '<img src="images/small/'.$value.'" class="small" />';
}
?>
Problem tkwi w tym, że grafiki wyświetlają się w absolutnie losowej kolejności. Jak mam przerobić kod, aby wyświetlały się np. wg nazwy (1.jpg, 2.jpg etc. tyle że w odwrotnej kolejności, aby najświeższy plik był na górze)?