random images
Posted by: theMezz
Posted on: 2009-02-21 22:02:00
I found many php scripts that allow me to display random images. BUT they work inside a htm(l) file... I need one that will work inside a php file !!!
suggestions ????
Thanks
Posted by: theMezz
Posted on: 2009-02-21 22:02:00
I found many php scripts that allow me to display random images. BUT they work inside a htm(l) file... I need one that will work inside a php file !!!
suggestions ????
Thanks
Posted by: Atropos7
Posted on: 2009-02-21 23:44:00
In reply to:I found many php scripts that allow me to display random images. BUT they work inside a htm(l) file... I need one that will work inside a php file !!!
suggestions ????
Hire a PHP developer to write something like this for you?
function randomimage() {
// A list of random image filenames.
$randomimage_filenames = array(
'image1.jpg',
'image2.gif',
'image3.jpg',
'image4.gif',
'image5.png'
);
// Count how many filenames there are.
$randomimage_count = count($randomimage_filenames);
// Pick one at random.
$randomimage_number = mt_rand(0, $randomimage_count - 1);
$randomimage_filename = $randomimage_filenames[$randomimage_number];
// Return the filename as our result.
return $randomimage_filename;
}
echo '<img src="' . randomimage() . '" alt="random image">';
openvein.org -//-