Jump to content

Random Image


Xtremer360

Recommended Posts

This is going to be tricky for everyone but here is goes. I have a random image function however I want the image attatched to a link that will go to the person's bio page. Even if I query anything how can I make sure that it matches up with what the right link person.

 

<a href="bio/".$shortname.""><img src="images/spotlight/<?php randlogo(); ?>" alt=".::Spotlight A KOW Superstar::." /></a>

 

<?php
function randlogo(){
$img = array();
if($handle = opendir('images/spotlight/')) {
	$count = 0;
	while (false !== ($file = readdir($handle))) {
		if(strlen($file) > 2){
			$img[$count] = $file;
			$count++;
		}
	}
}
echo $img[rand(0, (count($img)-1))];
} 
?>

Link to comment
https://forums.phpfreaks.com/topic/215928-random-image/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.