I have another modification to make to my Random Image Script and I'm hoping someone can help me with the punctuation. I need to add an [usemap="#Map"] to the code on line #7 below:

<?php 
//This will get an array of all the gif, jpg and png images in a folder 
$img_array = glob("/path/to/images/*.{gif,jpg,png}",GLOB_BRACE); 
//Pick a random image from the array 
$img = array_rand($img_array); 
//Display the image on the page 
echo '<img alt="'.$img_array[$img].'" src="'.$img_array[$img].'" />'; 
?>

Thanks in advance for any help.
~Marty

Member Avatar
diafol
echo '<img alt="'.$img_array[$img].'" src="'.$img_array[$img].'" usemap="#Map" />';

Is that it?? Seems you want something else, but I can't work out what.

echo '<img alt="'.$img_array[$img].'" src="'.$img_array[$img].'" usemap="#Map" />';

Is that it?? Seems you want something else, but I can't work out what.

Thank you ardav! No, that was exactly what I was looking for. Again I was on the right track just keep getting my (") and (') mixed up. It was becoming very frustrating. I just couldn't see where I messed up. Really appreciate your help.