Get help. Give help. A Web Design and Development Community.

random images

  • # August 24, 2009 at 4:34 pm

    is there a way of adding a script to randomly pick images from a folder. What i need is a new image everytime someone visits the homepage.

    At the moment its setup to output images using a custom field in wordpress but i can not find somthing to get it to pick random photo’s on each visit.

    Any help would be great.



    # August 24, 2009 at 4:41 pm

    Here ya go :)


    # August 26, 2009 at 5:16 pm

    This reply has been reported for inappropriate content.

    as rob has said, that thread has a few ideas, mine is best though ;)

    # August 27, 2009 at 7:39 am

    I use

    < ?php function randomImage ( $array ) { $total = count($array); $call = rand(0,$total-1); return $array[$call]; } $my_images = array ( "com.jpg", "image.jpg", "etc.jpg" ); $img = randomImage($my_images); ?>

    < ?php echo '‘; ?>

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.