Random images from folder

Random images from folder

                           

    <?php

 // random image folder variable 

 

$files = glob($_SERVER['DOCUMENT_ROOT'].$Variable1."/*.{jpg,gif,png,bmp}", GLOB_BRACE);

$ImageneFolderlegida = rand(0, count($files) - 1);

$Imagen = $Variable1.'/'.basename($files[$ImageneFolderlegida]);

 

  

?><?php echo $Imagen; ?>

 

 

 

 <?php // ********************************************************  imagen Cover Random*****************; ?>

 

  <?php if (empty($EfValue["cover-random-folder"])) { ?>

 <?php } else {  // cover random folder ?>  

 <?php $RutaFolder = $EfValue["cover-random-folder"]; ?>

 <?php

 // random image folder variable 

$Variable1 = $active->alias;

$files = glob($_SERVER['DOCUMENT_ROOT']."/images/portfolio/".$RutaFolder."/*.{jpg,gif,png,bmp}", GLOB_BRACE);

$ImageneFolderlegida = rand(0, count($files) - 1);

$CoverRandomPortfolio = "images/portfolio/".$RutaFolder.'/'.basename($files[$ImageneFolderlegida]);

?>

 <?php } // end cover random folder?>