Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    changeing image.....

    is there a php that changes an image......the main banner, say, every time the page is viewed?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    North East England
    Posts
    853
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, I use this randomising script for a similar purpose:
    PHP Code:
    $array[200];          //--number of banners/images
    $elem 0
    $dirname "images";  //--insert the name of the banner, in this example a file named "images" in the same directory as the rotation script
    $dh opendir($dirname); 
    while (
    $file readdir($dh)) { 
    if (!
    is_dir("$dirname/$file")) 
    $array[$elem] = $file
    $elem $elem 1


    srand((double)microtime() * 10000000); 
    $rand_keys array_rand($array); 
    $temp $array[$rand_keys]; 

    header("Location: $dirname/$temp"); 

    ?> 
    Then just link as so: <img src="filename.php"/>.
    [+] Computer/PC issues [+] Silverpaw3D
    ------------------------------------------------
    Never buy a dwarf with learning disabilities...

    ...it's not big, and it's not clever.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well, array_rand was a new one for me, looks like that'll be quite useful.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •