User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,552 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,472 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3816 | Replies: 13
Reply
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: display random images from folder

  #11  
Dec 10th, 2007
if thats the case, why not generate one more random number ?
  1. <?php
  2. $arr=array();
  3. for($i=0;$i<7;$i++){
  4. $arr[$i]="./img/images/".$i.".jpg";
  5. }
  6. $random=rand(0,6);
  7. $random_1=rand(0,6);
  8. echo "<img src=".$arr[$random].">";
  9. echo "<img src=".$arr[$random_1].">";
  10. ?>


This will do.. Don't you think ?
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*
Reply With Quote  
Join Date: Dec 2007
Posts: 2
Reputation: ezykiwi is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ezykiwi ezykiwi is offline Offline
Newbie Poster

Re: display random images from folder

  #12  
Dec 10th, 2007
that looks like it could do the trick with abit of working... basically....

i want there to be a folder of images... the names of those images could be anything at all.... number letters.. mixtures... there will be no logical order to them..... i just need the code to randomly pick say 10 images... out of that folder... no image being displayed twice etc...

if there isnt enough ... say there is 4 images.. it will just display 4

if there is no images... maybe just a statement showing there is no images to display at this time...
Reply With Quote  
Join Date: Mar 2008
Posts: 1
Reputation: WebServant is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
WebServant WebServant is offline Offline
Newbie Poster

Help Re: display random images from folder

  #13  
Mar 6th, 2008
Originally Posted by kkeith29 View Post
finished the code; i sent you a private message with the url of the test script

Hi, I am fairly new to web design and am trying to do exactly what you helped the other person on this post do, is there any way I could also get ahold of that code? I would be very grateful. Thanx.
Reply With Quote  
Join Date: Sep 2008
Posts: 1
Reputation: sreeneel is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sreeneel sreeneel is offline Offline
Newbie Poster

Re: display random images from folder

  #14  
Sep 30th, 2008
Hi,

I am new to Php. Iam unable to write a php code for random images on a webpage that displays new image each time it is refreshed. Im having images in a folder in my college FTP. Can any one post a code for me in Php ? Coz im unable to make the changes to my php file....
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:19 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC