Wyświetlanie:
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/');
rsort($tab);
foreach($tab as $value)
{
echo '<img src="images/small/'.$value.'" class="small" alt="" />';
}
?>
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/');
rsort($tab);
foreach($tab as $value)
{
echo '<img src="images/small/'.$value.'" class="small" alt="" />';
}
?>
Upload:
Kod
<?
if ($admaction == "addfrm_cfm"){
}
$cat_full = "../images/big";
$cat_thmb = "../images/small";
$foto_full = $_FILES[foto_full]['name'];
$foto_thmb = $_FILES[foto_thmb]['name'];
if(is_uploaded_file($_FILES[foto_full]['tmp_name'])){
move_uploaded_file($_FILES[foto_full]['tmp_name'],
"$cat_full/$foto_full");
echo "<p class=\"alert\"><b>Upload grafiki zakończony sukcesem.</b></p>";
}
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_full = "../images/big";
$cat_thmb = "../images/small";
$foto_full = $_FILES[foto_full]['name'];
$foto_thmb = $_FILES[foto_thmb]['name'];
if(is_uploaded_file($_FILES[foto_full]['tmp_name'])){
move_uploaded_file($_FILES[foto_full]['tmp_name'],
"$cat_full/$foto_full");
echo "<p class=\"alert\"><b>Upload grafiki zakończony sukcesem.</b></p>";
}
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>";
}
?>
Z góry dzięki za wszelką pomoc.