jeudi 26 mars 2015

Add unique text to each random background image

I'm using this script to randomize the background on my homepage. I would like to place text over the images, wrapped in a class "slogan", and that text has to be different for each image. How can I add it in?



<?php
$bg = array('/images/bg-01.jpg', '/images/bg-02.jpg','/images/bg-03.jpg' );

$i = rand(0, count($bg)-1); // generate random number size of the array
$selectedImg = "$bg[$i]"; // set variable equal to which random filename was chosen
?>


Thank you





Aucun commentaire:

Enregistrer un commentaire