Please support our PHP advertiser: Lunarpages PHP Web Hosting
![]() |
Hi guys...
I want some help of how to call images from a folder....
Its like..v have a folder called images and it has many images in it.....but i need only 6 images to display in a php webpage...when the webpage is reloaded, it displays another images...its like its displaying random images.....But in one page, i would like to display only 6 images....So, when the reload or visit again, the images or randomised from the images folder.....can any one know how can it be done....
I m not sure abt the codes...
Thanks
Tryphy
I want some help of how to call images from a folder....
Its like..v have a folder called images and it has many images in it.....but i need only 6 images to display in a php webpage...when the webpage is reloaded, it displays another images...its like its displaying random images.....But in one page, i would like to display only 6 images....So, when the reload or visit again, the images or randomised from the images folder.....can any one know how can it be done....
I m not sure abt the codes...
Thanks
Tryphy
•
•
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 714
Reputation:
Rep Power: 3
Solved Threads: 85
•
•
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 714
Reputation:
Rep Power: 3
Solved Threads: 85
•
•
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 714
Reputation:
Rep Power: 3
Solved Threads: 85
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 9
Solved Threads: 240
php Syntax (Toggle Plain Text)
<?php $arr=array(); for($i=0;$i<7;$i++){ $arr[$i]="./img/images/".$i.".jpg"; //assigning the image location to the array $arr. } $random=rand(0,6); //generating a random number echo "<img src=".$arr[$random].">"; //printing the image ?>
Thats it
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
Other Threads in the PHP Forum
- Random Images on Refresh (JavaScript / DHTML / AJAX)
- random images (PHP)
- Implementing Random Images (Java)
- Need help making simple random images (PHP)
- ASP .NET Display Random records from the database (ASP.NET)
- looking for a free or low cost program to randomly display text and/or images (PHP)
Other Threads in the PHP Forum
- Previous Thread: dynamically built webpage for multiple audio and text points.
- Next Thread: PHP Count & Display Question
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode