I have to display random photo using array and rand function.
Now I would add text under each photo(For example, the words of the elders text with image)
my code:
What do I do?
<?php$images=array( array('file'=>'pic1','alt'=>"Your Description About pic1"), array('file'=>'pic2','alt'=>"Your Description About pic2"), array('file'=>'pic3','alt'=>"Your Description About pic3"), array('file'=>'pic4','alt'=>"Your Description About pic4"), array('file'=>'pic5','alt'=>"Your Description About pic5"), array('file'=>'pic6','alt'=>"Your Description About pic6"), ) $i=rand(0,count($images)-1); $selectimage="newfolder/{$images[$i]['file']}.jpg"; $alt=$images[$i]['alt']; if (file_exists($selectimage) && is_readable($selectimage)) $imagesize= getimagesize($selectimage);?>
view in html
<img src="<?php echo $selectimage;?> " alt="<?php echo $alt ; ?>" <?php echo $imagesize[3] ; ?> />