Hmmm... Are you sure?



Search Freeola Chat ! 

Search Freeola Chat Forum...

 

Freeola Random Image PHP script demo

2.gif

3 images displayed at random for this demo.
'refresh' the page to view them - obviously with only 3 images used in this example
there's a good chance the image won't change!

 

Script taken from the Freeola Help page: http://freeola.com/support/webspace_php.php

Contents of randomimage.php

<?php
/*Create a new directory called images inside your htdocs folder
* Place your images inside this directory and name your images 1.jpg, 2.jpg etc.
*
* Add this line to your web page where you want the images to be displayed
* appear: <?php include "randomimage.php"; ?>
*/
// Change this to the total number of images in the folder
$total = "3";
// Change to the type of files to use eg. .jpg or .gif
$file_type = ".gif";
// Change to the location of the folder containing the images
$image_folder = "images";
// You do not need to edit below this line
$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";
?>

 

 

Search Freeola Chat Forum...

site map