Parašė Rasmitas· 2012 Gru. 15 22:12:32
#1
Reikia pagalbos:
Sitas skriptas rodo img is nurodytos papkes, bet tik viena img. Kaip padaryt , kad jisai rodytum pvz 4 img horizontaliai ?
<?php
//????????? ????? ? ?????????????
$folder_mas = array('dz/');
$images = array();
//???????? ????????? ?????
$folder = $folder_mas[rand(0,2)];
$all_files = scandir($folder);
while ($i++ < sizeof($all_files)){
//???????? ?????? ??????????? ? ??????????? .png, .jpg ? .gif
if (!strstr($all_files[$i],".png") and !strstr($all_files[$i],".jpg") and
!strstr($all_files[$i],".gif")) continue;
array_push($images, $all_files[$i]);
}
//???????? ????????? ??????????? ?? ?????
$img_random = $images[rand(0,sizeof($images)-1)];
$img_src = $folder."/".$img_random;
echo '<img src='.$img_src.' alt="">';
?>