I have the following svript which takes $dirr arras for picking an image. I want it to pick 2 images.
foreach ($dir as $key => $base_dir)
{
$i = 0;
$images = opendir ($DOCUMENT_ROOT.$base_dir);
while ($f = readdir($images))
{ if ($f != '.' && $f != '..')
{$img[$i++] = $f;}
}
closedir ($images);
$output = "/".$base_dir."/".$img[rand(0,sizeof($img)-1)];
unset ($img); //clear $img for next cycle
$h_w = GetImageSize ($DOCUMENT_ROOT.$output);
$$key = "<img border=\"0\" src=\"$output\" $h_w[3]" ;
}
the secound one should $$key2
how do i do that?
I considered just feeding the dir through twice but that would opendir and read it twice which seems inefficient.