This array is being created correctly, although i need to pick one then print it which isnt happening for me...any ideas?
<?php
$bgimagearray = array();
$iterator = new DirectoryIterator("/home/sites/yellostudio.co.uk/public_html/public/themes/yello/images/backgrounds");
foreach ($iterator as $fileinfo) {
if ($fileinfo->isFile() && !preg_match('/-c\.jpg$/', $fileinfo->getFilename())) {
$bgimagearray[] = "'" . $fileinfo->getFilename() . "'";
}
}
$bgimage = array_rand ( $bgimagearray, 2 );
?>
<img src="<?php echo URL_PUBLIC; ?>public/themes/yello/images/backgrounds/<?php echo $bgimage; ?>" alt=""/>