0

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

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by Marty1963
0
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.

0
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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.