Loading...
 
Gmail / Facebook Style Chat Application


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...


Views Today: 2
Total Views: 828

Comments
0
OUR OBJECTIVE

Our objective is to reach a place where our services will be highly regarded by businesses from various industrial domains for building their innovative busines solutions with our cutting-edge technological expertise, interactive designs and uncompromised quality.

OUR MISSION

We aspire to help businesses ranging from startups to enterprises, who reach out to us with their requirements, in achieving great lengths, expanding their reach, upscaling their products, and generate a large user-base with our outstanding and cost-effective services.

Copyright © 2011 - 2024 | All Rights Reserved