RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 4336 | Replies: 13 | Thread Tools  Display Modes
Reply
Join Date: Oct 2007
Posts: 19
Reputation: tryphy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tryphy's Avatar
tryphy tryphy is offline Offline
Newbie Poster

Question display random images from folder

  #1  
Oct 18th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 714
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 85
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Master Poster

Re: display random images from folder

  #2  
Oct 18th, 2007
ok sounds pretty easy. how do you want the images displayed on the page? in a table?
Reply With Quote  
Join Date: Oct 2007
Posts: 19
Reputation: tryphy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tryphy's Avatar
tryphy tryphy is offline Offline
Newbie Poster

Re: display random images from folder

  #3  
Oct 19th, 2007
Originally Posted by kkeith29 View Post
ok sounds pretty easy. how do you want the images displayed on the page? in a table?



Ya..in a table like in one row got 2 images...
so 3 rows and 2 columns...
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 714
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 85
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Master Poster

Re: display random images from folder

  #4  
Oct 19th, 2007
almost done, will post in a little while
Reply With Quote  
Join Date: Oct 2007
Posts: 19
Reputation: tryphy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tryphy's Avatar
tryphy tryphy is offline Offline
Newbie Poster

Re: display random images from folder

  #5  
Oct 19th, 2007
Thanks...
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 714
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 85
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Master Poster

Re: display random images from folder

  #6  
Oct 20th, 2007
finished the code; i sent you a private message with the url of the test script
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: display random images from folder

  #7  
Oct 21st, 2007
i posted exactly same one as you want 3 days ago.
Do a favour, leave me alone
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

  #8  
Dec 9th, 2007
Im new to the forums here but was just wondering if there is any chance of being able to look at the code? im looking for something similar to this but all the examples i have found online are for only displaying 1 random image at time...

Cheers Ezy
Reply With Quote  
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: 9
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: display random images from folder

  #9  
Dec 10th, 2007
  1. <?php
  2. $arr=array();
  3. for($i=0;$i<7;$i++){
  4. $arr[$i]="./img/images/".$i.".jpg"; //assigning the image location to the array $arr.
  5. }
  6. $random=rand(0,6); //generating a random number
  7. echo "<img src=".$arr[$random].">";
  8. //printing the image
  9. ?>

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*
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 714
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 85
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Master Poster

Re: display random images from folder

  #10  
Dec 10th, 2007
i think ezykiwi wanted to display more than one image. your code only displays one random image.
Reply With Quote  
Reply

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



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

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:41 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC