Autor Zpráva
k
Profil *
zdravim, funguje ale zobrazi se mi jen jedna fotka pomuže mi někdo stim jak udlat aby mi to vypsalo všechny? diky

<?php
$adresar = './fotky/'; //adresar
$dir = opendir ($adresar);
while ($soubor = readdir ($dir)) {
if (is_file ($adresar.$soubor)) {
$pole[] = $soubor;
}
}
$rand = array_rand ($pole);
echo "<img src='".$adresar.$pole[$rand]."' alt="Obrázek" width="45" height="45" />";
?>
k
Profil *

$adresar = './fotky/'; //adresar
$dir = opendir ($adresar);
while ($soubor = readdir ($dir)) {
if (is_file ($adresar.$soubor)) {
$pole[] = $soubor;
}
}
$rand = array_rand ($pole);
echo "<img src='".$adresar.$pole[$rand]."' alt="Obrázek" width="45" height="45" />";

bukaj
Profil

$adresar = './fotky/'; //adresar
$dir = opendir ($adresar);
while ($soubor = readdir ($dir)) {
if (is_file ($adresar.$soubor)) {
$pole[] = $soubor;
}
}
foreach($pole as $fotka){
echo "<img src='".$adresar.$fotka."' alt="Obrázek" width="45" height="45" />";
}

ale nevím, jestli je to to, co jsi myslel.
Alphard
Profil
jestli chceš vypsat všechny fotky v náhodném pořadí, tak ve scriptu od bukaje použij funkci shuffle()
Toto téma je uzamčeno. Odpověď nelze zaslat.

0