Announcement

Collapse
No announcement yet.

Random image rotator help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 ?>" />
    www.greenguana.com

  • #2
    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
    02036089024 / United Kingdom
    291916438 / Australia

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

    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)


    Comment


    • #3
      Re: Random image rotator help

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

      Comment


      • #4
        Re: Random image rotator help

        could you post a example path and url please.
        www.greenguana.com

        Comment


        • #5
          Re: Random image rotator help

          Is there no one that could help me out here?
          www.greenguana.com

          Comment

          Working...
          X