/ Published in: PHP
Outputs an image path from a defined directory.
Expand |
Embed | Plain Text
<?php $path_to_images = "/images/"; // path to your images $default_img = "image.gif"; // image to display if directory listing fails function getRandomImage($thispath, $img) { if ( $list = getImagesList($thispath) ) { $img = $list[$num]; } return $thispath . $img; } function getImagesList($thispath) { $ctr = 0; // can add checks for other image file types here $images[$ctr] = $img_file; $ctr++; } } return $images; } return false; } ?>
Comments
Subscribe to comments
You need to login to post a comment.

Hello, I can not get this to work, can you help please? this is the page: http://bertrandclerc.com/autres/random_images/script3.php