Results 1 to 5 of 5

Thread: Random image rotator help
      
   

  1. #1
    castro's Avatar
    castro is offline Sergeant
    Join Date
    Apr 2008
    Posts
    35

    Default Random image rotator help

    Hi all i got this code i need help with ist mind killing, a random image rotator
    i did everything it said to do where to put the path to my images but nothing came out please see what i did wrong. please help

    Thank You.

    this is what i had for my path: caribbeanbizconnections.com/randimages
    this is what i had for image url: http://www.caribbeanbizconnections.com/randimages

    <?php
    $imageDirectory = '/path/to/images/';
    $imageURL = '/url/to/images/';
    $randomImage = $imageURL . randomImage($imageDirectory);

    function randomImage($dir) {
    $files = array();
    if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
    while (false !== ($file = readdir($dh))) {
    if ($file != "." && $file != "..") {
    $files[] = $file;
    }
    }
    closedir($dh);
    }
    }
    $totalImages = count($files);
    $maxImages = $totalImages - 1;
    $randomImage = rand(0, $maxImages);
    return $files[$randomImage];
    }
    ?>

    <img src="<?= $randomImage ?>" />

  2. #2
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,353

    Default Re: Random image rotator help

    You dont have a folder and an index for that folder.. or even a pagename for that folder. The extension will have to be a php too by the way.

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  3. #3
    castro's Avatar
    castro is offline Sergeant
    Join Date
    Apr 2008
    Posts
    35

    Default Re: Random image rotator help

    but don't i only need a folder where is store the images? Like randimages

  4. #4
    castro's Avatar
    castro is offline Sergeant
    Join Date
    Apr 2008
    Posts
    35

    Default Re: Random image rotator help

    could you post a example path and url please.

  5. #5
    castro's Avatar
    castro is offline Sergeant
    Join Date
    Apr 2008
    Posts
    35

    Default Re: Random image rotator help

    Is there no one that could help me out here?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49