Gmail / Facebook Style Chat Application
Details Live Demo Download


Posted: Monday 7th of January 2013

Display Random Images using PHP



This tutorial teaches you how to build a system that uses an array to display all the images in a specified directory on your server in a randomized format using PHP.

The script is easy to understand as it uses just two functions whicg are as follows:

(1) vpb_getImagesFromFolder: This function contains three fields which are (1) The directory where your images are located on your server, (2) Your desired width for your images and (3) Your desired height for your images.

The vpb_getImagesFromFolder function gets a list 'array' of the images in the directory you specify and displays to the user on the screen.

(2) vpb_getRandomImagesFromArray: This function selects an entry from the list 'array' brought by the vpb_getImagesFromFolder function at random.

The code is brief and simple, requiring only two functions: getImagesFromDir obtains . getRandomFromArray selects an entry from this array at random.

To use the script, just specify the below fields:

$directory_of_images = "photos"; //This is the directory where your images are kept on your server
$width_of_the_images = 400; //This is the width of your images
$height_of_the_images = 300; //This is the height of your images

To see the system in action, please click on the demo button below and download the script if you like what you see.

Display Random Images using PHP






That's it guys...



Comments
0

 

Announcement x
Dear Users and Clients,

This is to inform you that we have recently updated our website generally.

If you experience any problem viewing any part of this website or if you notice that any of our scripts or tutorials are not functioning properly as should be, please click on the Contact Link at the top of this page to report the issue to us.

Our priority is to give you the best of service!


Thank You,
The Vasplus Team

Announcement